Fix submit button selector in specs
This commit is contained in:
parent
327cae1da7
commit
0e4033860b
|
@ -114,6 +114,8 @@ describe('operation settings external dashboard component', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('submit button', () => {
|
describe('submit button', () => {
|
||||||
|
const findSubmitButton = () => wrapper.find('.settings-content form').find(GlButton);
|
||||||
|
|
||||||
const endpointRequest = [
|
const endpointRequest = [
|
||||||
operationsSettingsEndpoint,
|
operationsSettingsEndpoint,
|
||||||
{
|
{
|
||||||
|
@ -127,14 +129,14 @@ describe('operation settings external dashboard component', () => {
|
||||||
|
|
||||||
it('renders button label', () => {
|
it('renders button label', () => {
|
||||||
mountComponent();
|
mountComponent();
|
||||||
const submit = wrapper.find(GlButton);
|
const submit = findSubmitButton();
|
||||||
expect(submit.text()).toBe('Save Changes');
|
expect(submit.text()).toBe('Save Changes');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('submits form on click', () => {
|
it('submits form on click', () => {
|
||||||
mountComponent(false);
|
mountComponent(false);
|
||||||
axios.patch.mockResolvedValue();
|
axios.patch.mockResolvedValue();
|
||||||
wrapper.find(GlButton).trigger('click');
|
findSubmitButton().trigger('click');
|
||||||
|
|
||||||
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
|
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
|
||||||
|
|
||||||
|
@ -145,7 +147,7 @@ describe('operation settings external dashboard component', () => {
|
||||||
mountComponent(false);
|
mountComponent(false);
|
||||||
const message = 'mockErrorMessage';
|
const message = 'mockErrorMessage';
|
||||||
axios.patch.mockRejectedValue({ response: { data: { message } } });
|
axios.patch.mockRejectedValue({ response: { data: { message } } });
|
||||||
wrapper.find(GlButton).trigger('click');
|
findSubmitButton().trigger('click');
|
||||||
|
|
||||||
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
|
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue