|
@@ -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
|
|
@@ -46,7 +46,7 @@ describe('chromium feature', function () {
|
|
|
var w = null
|
|
|
|
|
|
afterEach(function () {
|
|
|
- w != null ? w.destroy() : void 0
|
|
|
+ return closeWindow(w).then(function () { w = null })
|
|
|
})
|
|
|
|
|
|
it('is set correctly when window is not shown', function (done) {
|
|
@@ -157,7 +157,7 @@ describe('chromium feature', function () {
|
|
|
var w = null
|
|
|
|
|
|
afterEach(function () {
|
|
|
- w != null ? w.destroy() : void 0
|
|
|
+ return closeWindow(w).then(function () { w = null })
|
|
|
})
|
|
|
|
|
|
it('should register for file scheme', function (done) {
|
|
@@ -187,6 +187,12 @@ describe('chromium feature', function () {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ let w = null
|
|
|
+
|
|
|
+ afterEach(() => {
|
|
|
+ return closeWindow(w).then(function () { w = null })
|
|
|
+ })
|
|
|
+
|
|
|
it('returns a BrowserWindowProxy object', function () {
|
|
|
var b = window.open('about:blank', '', 'show=no')
|
|
|
assert.equal(b.closed, false)
|
|
@@ -260,6 +266,28 @@ 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.equal(options.show, false)
|
|
|
+ assert.deepEqual(options.foo, {
|
|
|
+ bar: null,
|
|
|
+ baz: {
|
|
|
+ hello: {
|
|
|
+ world: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ baz2: {
|
|
|
+ hello: {
|
|
|
+ world: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
it('defines a window.location getter', function (done) {
|
|
|
var b, targetURL
|
|
|
if (process.platform === 'win32') {
|
|
@@ -312,7 +340,7 @@ describe('chromium feature', function () {
|
|
|
let w = null
|
|
|
|
|
|
afterEach(function () {
|
|
|
- if (w) w.destroy()
|
|
|
+ return closeWindow(w).then(function () { w = null })
|
|
|
})
|
|
|
|
|
|
it('is null for main window', function (done) {
|