Move pushState spec chromium-spec with other history specs

This commit is contained in:
Kevin Sawicki 2017-06-05 14:45:22 -07:00
parent 3a9b035d36
commit 777b5b17de
2 changed files with 26 additions and 21 deletions

View file

@ -647,20 +647,4 @@ describe('webContents module', function () {
gen.next() gen.next()
}) })
}) })
describe('History API', () => {
it('should push state after calling history.pushState() from the same url', (done) => {
w.loadURL('about:blank')
w.webContents.once('did-finish-load', () => {
// History should have current page by now.
assert.equal(w.webContents.length(), 1)
w.webContents.executeJavaScript('window.history.pushState({}, "")', (result) => {
// Initial page + pushed state
assert.equal(w.webContents.length(), 2)
done()
})
})
})
})
}) })

View file

@ -1100,6 +1100,7 @@ describe('chromium feature', function () {
}) })
}) })
describe('window.history', function () {
describe('window.history.go(offset)', function () { describe('window.history.go(offset)', function () {
it('throws an exception when the argumnet cannot be converted to a string', function () { it('throws an exception when the argumnet cannot be converted to a string', function () {
assert.throws(function () { assert.throws(function () {
@ -1107,4 +1108,24 @@ describe('chromium feature', function () {
}, /Cannot convert object to primitive value/) }, /Cannot convert object to primitive value/)
}) })
}) })
describe('window.history.pushState', function () {
it('should push state after calling history.pushState() from the same url', (done) => {
w = new BrowserWindow({
show: false
})
w.loadURL('about:blank')
w.webContents.once('did-finish-load', () => {
// History should have current page by now.
assert.equal(w.webContents.length(), 1)
w.webContents.executeJavaScript('window.history.pushState({}, "")', () => {
// Initial page + pushed state
assert.equal(w.webContents.length(), 2)
done()
})
})
})
})
})
}) })