test: make window.history.pushState test more robust (#21875)
This commit is contained in:
parent
5781850706
commit
74acd17771
1 changed files with 9 additions and 11 deletions
|
@ -1089,19 +1089,17 @@ describe('chromium features', () => {
|
||||||
|
|
||||||
describe('window.history', () => {
|
describe('window.history', () => {
|
||||||
describe('window.history.pushState', () => {
|
describe('window.history.pushState', () => {
|
||||||
it('should push state after calling history.pushState() from the same url', (done) => {
|
it('should push state after calling history.pushState() from the same url', async () => {
|
||||||
const w = new BrowserWindow({ show: false })
|
const w = new BrowserWindow({ show: false })
|
||||||
w.webContents.once('did-finish-load', async () => {
|
await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'))
|
||||||
// History should have current page by now.
|
// History should have current page by now.
|
||||||
expect((w.webContents as any).length()).to.equal(1)
|
expect((w.webContents as any).length()).to.equal(1)
|
||||||
|
|
||||||
w.webContents.executeJavaScript('window.history.pushState({}, "")').then(() => {
|
const waitCommit = emittedOnce(w.webContents, 'navigation-entry-commited')
|
||||||
// Initial page + pushed state
|
w.webContents.executeJavaScript('window.history.pushState({}, "")')
|
||||||
expect((w.webContents as any).length()).to.equal(2)
|
await waitCommit
|
||||||
done()
|
// Initial page + pushed state.
|
||||||
})
|
expect((w.webContents as any).length()).to.equal(2)
|
||||||
})
|
|
||||||
w.loadURL('about:blank')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue