Add failing spec for cycle in options
This commit is contained in:
parent
b942c54bea
commit
12382f064b
3 changed files with 32 additions and 2 deletions
|
@ -3,7 +3,7 @@ const http = require('http')
|
|||
const path = require('path')
|
||||
const ws = require('ws')
|
||||
const url = require('url')
|
||||
const remote = require('electron').remote
|
||||
const {ipcRenderer, remote} = require('electron')
|
||||
const {closeWindow} = require('./window-helpers')
|
||||
|
||||
const {BrowserWindow, ipcMain, protocol, session, webContents} = remote
|
||||
|
@ -187,6 +187,12 @@ describe('chromium feature', function () {
|
|||
return
|
||||
}
|
||||
|
||||
let w = null
|
||||
|
||||
afterEach(() => {
|
||||
return closeWindow(w).then(() => w = null)
|
||||
})
|
||||
|
||||
it('returns a BrowserWindowProxy object', function () {
|
||||
var b = window.open('about:blank', '', 'show=no')
|
||||
assert.equal(b.closed, false)
|
||||
|
@ -260,6 +266,20 @@ describe('chromium feature', function () {
|
|||
b = window.open('file://' + fixtures + '/pages/window-open-size.html', '', 'show=no,width=' + size.width + ',height=' + size.height)
|
||||
})
|
||||
|
||||
it('handles cycles when merging the parent options into the child options', (done) => {
|
||||
w = BrowserWindow.fromId(ipcRenderer.sendSync('create-window-with-options-cycle'))
|
||||
w.loadURL('file://' + fixtures + '/pages/window-open.html')
|
||||
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
|
||||
assert.deepEqual(options, {
|
||||
show: false,
|
||||
foo: {
|
||||
bar: null
|
||||
}
|
||||
})
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('defines a window.location getter', function (done) {
|
||||
var b, targetURL
|
||||
if (process.platform === 'win32') {
|
||||
|
|
2
spec/fixtures/pages/window-open.html
vendored
2
spec/fixtures/pages/window-open.html
vendored
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.open('http://host', 'host' , 'this-is-not-a-standard-feature');
|
||||
window.open('http://host', 'host', 'this-is-not-a-standard-feature');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -230,3 +230,13 @@ ipcMain.on('close-on-will-navigate', (event, id) => {
|
|||
contents.send('closed-on-will-navigate')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
ipcMain.on('create-window-with-options-cycle', (event) => {
|
||||
// This can't be done over remote since cycles are already
|
||||
// nulled out at the IPC layer
|
||||
const foo = {}
|
||||
foo.bar = foo
|
||||
const window = new BrowserWindow({show: false, foo: foo})
|
||||
event.returnValue = window.id
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue