diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-13 10:35:40 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-13 10:35:40 +0100 |
commit | fc828b401c7783fb8fd61494082993ca01b20bfa (patch) | |
tree | 583a2e5487d777ca5aebdb8d01828f9102e176e8 /spec/javascripts/flash_spec.js | |
parent | fe3ec2d92149d999f379e9a49885c738b6fe41dd (diff) | |
download | gitlab-ce-fc828b401c7783fb8fd61494082993ca01b20bfa.tar.gz |
Fixed server rendered flash not being removed on clickserver-flash-click-remove
Diffstat (limited to 'spec/javascripts/flash_spec.js')
-rw-r--r-- | spec/javascripts/flash_spec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/javascripts/flash_spec.js b/spec/javascripts/flash_spec.js index 060ffaa339b..b669aabcee4 100644 --- a/spec/javascripts/flash_spec.js +++ b/spec/javascripts/flash_spec.js @@ -2,6 +2,7 @@ import flash, { createFlashEl, createAction, hideFlash, + removeFlashClickListener, } from '~/flash'; describe('Flash', () => { @@ -266,4 +267,24 @@ describe('Flash', () => { }); }); }); + + describe('removeFlashClickListener', () => { + beforeEach(() => { + document.body.innerHTML += '<div class="flash-container"><div class="flash"></div></div>'; + }); + + it('removes global flash on click', (done) => { + const flashEl = document.querySelector('.flash'); + + removeFlashClickListener(flashEl, false); + + flashEl.parentNode.click(); + + setTimeout(() => { + expect(document.querySelector('.flash')).toBeNull(); + + done(); + }); + }); + }); }); |