diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-04-20 16:07:06 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-05-15 22:26:52 +0200 |
commit | 1fe6beae47d99271b50c473082c4bac6daa0d0a3 (patch) | |
tree | 6976cc479571b32d50b5cef654259291265d6808 /spec/javascripts | |
parent | 361b2b135ff020cb628f1d0617e191a8bde620bf (diff) | |
download | gitlab-ce-1fe6beae47d99271b50c473082c4bac6daa0d0a3.tar.gz |
Notes: Warning message should go away once resolved
Flash error messages disappear(`fadeOut`) automatically after any successful request
Diffstat (limited to 'spec/javascripts')
-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 be4605a5b89..ae59ee787a8 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); @@ -460,5 +461,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); |