fix: backport Node nested microtask fix (#20303)

This commit is contained in:
Jeremy Apthorp 2019-09-25 17:38:50 -04:00 committed by GitHub
parent 0653e31767
commit 593f1774e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 19 deletions

View file

@ -359,7 +359,6 @@ describe('webContents module', () => {
// For some reason we have to wait for two focused events...?
await emittedOnce(w.webContents, 'devtools-focused')
await emittedOnce(w.webContents, 'devtools-focused')
expect(() => { webContents.getFocusedWebContents() }).to.not.throw()
@ -444,9 +443,10 @@ describe('webContents module', () => {
await focused
expect(w.isFocused()).to.be.true()
w.webContents.openDevTools({ mode: 'detach', activate: true })
await emittedOnce(w.webContents, 'devtools-focused')
await emittedOnce(w.webContents, 'devtools-focused')
await emittedOnce(w.webContents, 'devtools-opened')
await Promise.all([
emittedOnce(w.webContents, 'devtools-opened'),
emittedOnce(w.webContents, 'devtools-focused'),
])
await new Promise(resolve => setTimeout(resolve, 0))
expect(w.isFocused()).to.be.false()
})
@ -572,8 +572,6 @@ describe('webContents module', () => {
const [, zoomDirection] = await emittedOnce(w.webContents, 'zoom-changed')
expect(zoomDirection).to.equal(zoomingIn ? 'in' : 'out')
// Apparently we get two zoom-changed events??
await emittedOnce(w.webContents, 'zoom-changed')
}
await testZoomChanged({ zoomingIn: true })