1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-24 20:02:53 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
// replace the fixture, which was just wiped out
fixtureEl = getFixture()
done()
const wrapper = fixtureEl.querySelector('#wrapper')
const instance = new Backdrop({
isVisible: true,
isAnimated: true,
rootElement: wrapper
})
const getElements = () => document.querySelectorAll(CLASS_BACKDROP)
instance.show(() => {
wrapper.parentNode.removeChild(wrapper)
instance.hide(() => {
expect(getElements().length).toEqual(0)
done()
})
})
document.body.innerHTML = 'changed'
})
})