diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-11-09 22:48:38 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-11-09 22:48:38 +0300 |
commit | 551c708ce8bbcd98c72c2b86cdcc8006a588215d (patch) | |
tree | 73b3b855eb840bb0a9c8b322d432554f7771a972 /spec | |
parent | 1bf689563bfde933cd3e8d3fb58cb36c1a45d3af (diff) | |
parent | 8ba8800660323c516117f040d785ff1e0abac687 (diff) |
Merge branch 'disable-issue-action-button-if-isSubmitting' into 'master'
Disable issue action button whilst submitting and test
See merge request gitlab-org/gitlab-ce!15211
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/notes/components/issue_comment_form_spec.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/javascripts/notes/components/issue_comment_form_spec.js b/spec/javascripts/notes/components/issue_comment_form_spec.js index a26fc8f63cc..db75262b562 100644 --- a/spec/javascripts/notes/components/issue_comment_form_spec.js +++ b/spec/javascripts/notes/components/issue_comment_form_spec.js @@ -55,6 +55,25 @@ describe('issue_comment_form component', () => { expect(vm.toggleIssueState).toHaveBeenCalled(); }); + + it('should disable action button whilst submitting', (done) => { + const saveNotePromise = Promise.resolve(); + vm.note = 'hello world'; + spyOn(vm, 'saveNote').and.returnValue(saveNotePromise); + spyOn(vm, 'stopPolling'); + + const actionButton = vm.$el.querySelector('.js-action-button'); + + vm.handleSave(); + + Vue.nextTick() + .then(() => expect(actionButton.disabled).toBeTruthy()) + .then(saveNotePromise) + .then(Vue.nextTick) + .then(() => expect(actionButton.disabled).toBeFalsy()) + .then(done) + .catch(done.fail); + }); }); describe('textarea', () => { |