diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-01-26 17:49:49 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-01-31 01:18:19 +0300 |
commit | 992fcf6c87721405be59d2a22da7d21157e17f45 (patch) | |
tree | 0fe46a861b647356a605aa8a76d1d07b679a1065 /spec/javascripts/issue_show | |
parent | f00c6db83f1f8b0bbb35230cfede0cfddfc9f7da (diff) |
Add missing specs.
Diffstat (limited to 'spec/javascripts/issue_show')
-rw-r--r-- | spec/javascripts/issue_show/components/app_spec.js | 13 | ||||
-rw-r--r-- | spec/javascripts/issue_show/components/description_spec.js | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index c3f624aebd3..028a36d3496 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -469,5 +469,18 @@ describe('Issuable output', () => { .then(done) .catch(done.fail); }); + + it('should show error message if store update fails', done => { + spyOn(vm.service, 'getData').and.returnValue(Promise.reject()); + spyOn(window, 'Flash'); + vm.issuableType = 'merge request'; + + vm.updateStoreState() + .then(() => { + expect(window.Flash).toHaveBeenCalledWith(`Error updating ${vm.issuableType}`); + }) + .then(done) + .catch(done.fail); + }); }); }); diff --git a/spec/javascripts/issue_show/components/description_spec.js b/spec/javascripts/issue_show/components/description_spec.js index 52148f4c66b..b6833079e6e 100644 --- a/spec/javascripts/issue_show/components/description_spec.js +++ b/spec/javascripts/issue_show/components/description_spec.js @@ -187,4 +187,18 @@ describe('Description component', () => { it('sets data-update-url', () => { expect(vm.$el.querySelector('textarea').dataset.updateUrl).toEqual(gl.TEST_HOST); }); + + describe('taskListUpdateError', () => { + it('should create flash notification and emit an event to parent', () => { + const msg = + 'Someone edited this issue at the same time you did and we updated the issue description.'; + spyOn(window, 'Flash'); + spyOn(vm, '$emit'); + + vm.taskListUpdateError(); + + expect(window.Flash).toHaveBeenCalledWith(msg); + expect(vm.$emit).toHaveBeenCalledWith('taskListUpdateFailed'); + }); + }); }); |