diff options
author | Ryan Weaver <weaverryan+github@gmail.com> | 2021-05-22 01:16:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-22 01:16:05 +0300 |
commit | a2b5901efc6de12bb828f8dda118ddccbcd545cf (patch) | |
tree | 6f349f5912e5f12b31a4ea508fce67ac444a2602 /js/tests/unit/util | |
parent | d64466a2488bbaac9a1005db3a199a8bc6846e3e (diff) |
Fix bug where backdrop calls method on null if it is already removed from the body (#34014)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Diffstat (limited to 'js/tests/unit/util')
-rw-r--r-- | js/tests/unit/util/backdrop.spec.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/tests/unit/util/backdrop.spec.js b/js/tests/unit/util/backdrop.spec.js index ae342b0929..02dea5a25b 100644 --- a/js/tests/unit/util/backdrop.spec.js +++ b/js/tests/unit/util/backdrop.spec.js @@ -129,6 +129,25 @@ describe('Backdrop', () => { }) }) + it('should not error if the backdrop no longer has a parent', done => { + const instance = new Backdrop({ + isVisible: true, + isAnimated: true + }) + const getElements = () => document.querySelectorAll(CLASS_BACKDROP) + + instance.show(() => { + instance.hide(() => { + expect(getElements().length).toEqual(0) + + // replace the fixture, which was just wiped out + fixtureEl = getFixture() + done() + }) + document.body.innerHTML = 'changed' + }) + }) + describe('click callback', () => { it('it should execute callback on click', done => { const spy = jasmine.createSpy('spy') |