Add spec for native window.open from iframe
This commit is contained in:
parent
8f22e6a265
commit
f5cf6d4ddd
3 changed files with 19 additions and 1 deletions
|
@ -1285,6 +1285,14 @@ describe('BrowserWindow module', function () {
|
|||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-file.html'))
|
||||
})
|
||||
|
||||
it('opens window from <iframe> tags', (done) => {
|
||||
ipcMain.once('answer', (event, content) => {
|
||||
assert.equal(content, 'Hello')
|
||||
done()
|
||||
})
|
||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-iframe.html'))
|
||||
})
|
||||
|
||||
if (process.platform !== 'win32' || process.execPath.toLowerCase().indexOf('\\out\\d\\') === -1) {
|
||||
it('loads native addons correctly after reload', (done) => {
|
||||
ipcMain.once('answer', (event, content) => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
const {ipcRenderer} = require('electron')
|
||||
const {ipcRenderer} = window.top != null ? window.top.require('electron') : require('electron')
|
||||
const popup = window.open()
|
||||
popup.document.write('<h1>Hello</h1>')
|
||||
const content = popup.document.querySelector('h1').innerText
|
||||
|
|
10
spec/fixtures/api/native-window-open-iframe.html
vendored
Normal file
10
spec/fixtures/api/native-window-open-iframe.html
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="./native-window-open-blank.html"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue