diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-11-06 11:42:11 +0000 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-11-06 11:42:11 +0000 |
commit | 8ba8800660323c516117f040d785ff1e0abac687 (patch) | |
tree | 2ed269ad0d2d6d76706fa93dbc78618d5a0636fa /spec/javascripts | |
parent | 46dc343f605f0c98d2b9ec44617d313a1548b4e2 (diff) | |
download | gitlab-ce-disable-issue-action-button-if-isSubmitting.tar.gz |
Disable issue action button whilst submitting and testdisable-issue-action-button-if-isSubmitting
Diffstat (limited to 'spec/javascripts')
-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', () => { |