Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test of #34014 #34070

Merged
merged 1 commit into from
May 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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