aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/tests/unit/util/backdrop.spec.js30
1 files changed, 16 insertions, 14 deletions
diff --git a/js/tests/unit/util/backdrop.spec.js b/js/tests/unit/util/backdrop.spec.js
index 02dea5a25..195d5067c 100644
--- a/js/tests/unit/util/backdrop.spec.js
+++ b/js/tests/unit/util/backdrop.spec.js
@@ -127,24 +127,26 @@ 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)
+ it('should not error if the backdrop no longer has a parent', done => {
+ fixtureEl.innerHTML = '<div id="wrapper"></div>'
- instance.show(() => {
- instance.hide(() => {
- expect(getElements().length).toEqual(0)
+ const wrapper = fixtureEl.querySelector('#wrapper')
+ const instance = new Backdrop({
+ isVisible: true,
+ isAnimated: true,
+ rootElement: wrapper
+ })
- // replace the fixture, which was just wiped out
- fixtureEl = getFixture()
- done()
+ const getElements = () => document.querySelectorAll(CLASS_BACKDROP)
+
+ instance.show(() => {
+ wrapper.parentNode.removeChild(wrapper)
+ instance.hide(() => {
+ expect(getElements().length).toEqual(0)
+ done()
+ })
})
- document.body.innerHTML = 'changed'
})
})