diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-16 09:01:59 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-16 09:01:59 +0000 |
commit | 3599d9ab90f1ec7f4f271437509a2471b767f544 (patch) | |
tree | 82de075f5a5f517174d0ca530b237015f47e9f46 /spec | |
parent | 21c96a657c4bb9f64cdf9e548280e10266bc6ee9 (diff) | |
parent | 1fe6beae47d99271b50c473082c4bac6daa0d0a3 (diff) | |
download | gitlab-ce-3599d9ab90f1ec7f4f271437509a2471b767f544.tar.gz |
Merge branch '24373-warning-message-go-away' into 'master'
Notes warning message should go away once resolved
Closes #24373
See merge request !10823
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/notes_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index 8243a9c991a..87745ea9817 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -14,6 +14,7 @@ import '~/notes'; gl.utils = gl.utils || {}; describe('Notes', function() { + const FLASH_TYPE_ALERT = 'alert'; var commentsTemplate = 'issues/issue_with_comment.html.raw'; preloadFixtures(commentsTemplate); @@ -498,5 +499,33 @@ import '~/notes'; expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeTruthy(); }); }); + + describe('appendFlash', () => { + beforeEach(() => { + this.notes = new Notes(); + }); + + it('shows a flash message', () => { + this.notes.addFlash('Error message', FLASH_TYPE_ALERT, this.notes.parentTimeline); + + expect(document.querySelectorAll('.flash-alert').length).toBe(1); + }); + }); + + describe('clearFlash', () => { + beforeEach(() => { + $(document).off('ajax:success'); + this.notes = new Notes(); + }); + + it('removes all the associated flash messages', () => { + this.notes.addFlash('Error message 1', FLASH_TYPE_ALERT, this.notes.parentTimeline); + this.notes.addFlash('Error message 2', FLASH_TYPE_ALERT, this.notes.parentTimeline); + + this.notes.clearFlash(); + + expect(document.querySelectorAll('.flash-alert').length).toBe(0); + }); + }); }); }).call(window); |