Skip to content

Commit

Permalink
fix test of #34014 (#34070)
Browse files Browse the repository at this point in the history
Fixes regression of a2b5901 breaking the test runner because it would wipe document.body.
  • Loading branch information
GeoSot committed May 22, 2021
1 parent a2b5901 commit e06e6df
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions js/tests/unit/util/backdrop.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
})

Expand Down

0 comments on commit e06e6df

Please sign in to comment.