diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:08:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:08:57 +0000 |
commit | d8121cb00b8bbd281d7362902590b110639bdeba (patch) | |
tree | 0a0f71b247b232773a46732d9f74aa3cfed0ef1a /spec/frontend/registry/settings/components/settings_form_spec.js | |
parent | 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 (diff) | |
download | gitlab-ce-d8121cb00b8bbd281d7362902590b110639bdeba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/registry/settings/components/settings_form_spec.js')
-rw-r--r-- | spec/frontend/registry/settings/components/settings_form_spec.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/frontend/registry/settings/components/settings_form_spec.js b/spec/frontend/registry/settings/components/settings_form_spec.js index 5b81d034e14..89dd161ec3e 100644 --- a/spec/frontend/registry/settings/components/settings_form_spec.js +++ b/spec/frontend/registry/settings/components/settings_form_spec.js @@ -124,11 +124,35 @@ describe('Settings Form', () => { form = findForm(); }); - describe('form cancel event', () => { + describe('cancel button', () => { it('has type reset', () => { expect(findCancelButton().attributes('type')).toBe('reset'); }); + it('is disabled the form was not changed from his original value', () => { + store.dispatch('receiveSettingsSuccess', { foo: 'bar' }); + return wrapper.vm.$nextTick().then(() => { + expect(findCancelButton().attributes('disabled')).toBe('true'); + }); + }); + + it('is disabled when the form data is loading', () => { + store.dispatch('toggleLoading'); + return wrapper.vm.$nextTick().then(() => { + expect(findCancelButton().attributes('disabled')).toBe('true'); + }); + }); + + it('is enabled when the user changed something in the form and the data is not being loaded', () => { + store.dispatch('receiveSettingsSuccess', { foo: 'bar' }); + store.dispatch('updateSettings', { foo: 'baz' }); + return wrapper.vm.$nextTick().then(() => { + expect(findCancelButton().attributes('disabled')).toBe(undefined); + }); + }); + }); + + describe('form cancel event', () => { it('calls the appropriate function', () => { dispatchSpy.mockReturnValue(); form.trigger('reset'); |