1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-13 17:14:04 +02:00
Fixes regression of a2b5901efc breaking the test runner because it would wipe document.body.
This commit is contained in:
GeoSot
2021-05-22 03:54:32 +03:00
committed by GitHub
parent a2b5901efc
commit e06e6dfe53

View File

@@ -127,24 +127,26 @@ describe('Backdrop', () => {
}) })
}) })
}) })
})
it('should not error if the backdrop no longer has a parent', done => { it('should not error if the backdrop no longer has a parent', done => {
const instance = new Backdrop({ fixtureEl.innerHTML = '<div id="wrapper"></div>'
isVisible: true,
isAnimated: true
})
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)
instance.show(() => { const wrapper = fixtureEl.querySelector('#wrapper')
instance.hide(() => { const instance = new Backdrop({
expect(getElements().length).toEqual(0) isVisible: true,
isAnimated: true,
// replace the fixture, which was just wiped out rootElement: wrapper
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'
}) })
}) })