Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-04-20 17:07:06 +0300
committerJacopo <beschi.jacopo@gmail.com>2017-05-15 23:26:52 +0300
commit1fe6beae47d99271b50c473082c4bac6daa0d0a3 (patch)
tree6976cc479571b32d50b5cef654259291265d6808 /spec/javascripts/notes_spec.js
parent361b2b135ff020cb628f1d0617e191a8bde620bf (diff)
Notes: Warning message should go away once resolved
Flash error messages disappear(`fadeOut`) automatically after any successful request
Diffstat (limited to 'spec/javascripts/notes_spec.js')
-rw-r--r--spec/javascripts/notes_spec.js29
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);