Split test HTML file into separate ones
This commit is contained in:
parent
1d73e84a29
commit
edeac2f59e
5 changed files with 35 additions and 33 deletions
|
@ -1099,14 +1099,14 @@ describe('BrowserWindow module', function () {
|
||||||
assert.equal(content, 'Hello')
|
assert.equal(content, 'Hello')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#blank'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-blank.html'))
|
||||||
})
|
})
|
||||||
it('opens window of same domain with cross-scripting enabled', (done) => {
|
it('opens window of same domain with cross-scripting enabled', (done) => {
|
||||||
ipcMain.once('answer', (event, content) => {
|
ipcMain.once('answer', (event, content) => {
|
||||||
assert.equal(content, 'Hello')
|
assert.equal(content, 'Hello')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#file'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-file.html'))
|
||||||
})
|
})
|
||||||
it('loads native addons correctly after reload', (done) => {
|
it('loads native addons correctly after reload', (done) => {
|
||||||
ipcMain.once('answer', (event, content) => {
|
ipcMain.once('answer', (event, content) => {
|
||||||
|
@ -1117,7 +1117,7 @@ describe('BrowserWindow module', function () {
|
||||||
})
|
})
|
||||||
w.reload()
|
w.reload()
|
||||||
})
|
})
|
||||||
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open.html#native-addon'))
|
w.loadURL('file://' + path.join(fixtures, 'api', 'native-window-open-native-addon.html'))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
11
spec/fixtures/api/native-window-open-blank.html
vendored
Normal file
11
spec/fixtures/api/native-window-open-blank.html
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
const {ipcRenderer} = require("electron");
|
||||||
|
const popup = window.open();
|
||||||
|
popup.document.write('<h1>Hello</h1>');
|
||||||
|
const content = popup.document.querySelector('h1').innerText;
|
||||||
|
ipcRenderer.send('answer', content);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
12
spec/fixtures/api/native-window-open-file.html
vendored
Normal file
12
spec/fixtures/api/native-window-open-file.html
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
const {ipcRenderer} = require("electron");
|
||||||
|
const popup = window.open('native-window-open-child.html');
|
||||||
|
popup.onload = () => {
|
||||||
|
const content = popup.document.querySelector('h1').innerText;
|
||||||
|
ipcRenderer.send('answer', content);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
9
spec/fixtures/api/native-window-open-native-addon.html
vendored
Normal file
9
spec/fixtures/api/native-window-open-native-addon.html
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
const {ipcRenderer} = require("electron");
|
||||||
|
const runas = require('runas');
|
||||||
|
ipcRenderer.send('answer', typeof runas);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
30
spec/fixtures/api/native-window-open.html
vendored
30
spec/fixtures/api/native-window-open.html
vendored
|
@ -1,30 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
const {ipcRenderer} = require("electron");
|
|
||||||
const tests = {
|
|
||||||
'blank': () => {
|
|
||||||
const popup = window.open();
|
|
||||||
popup.document.write('<h1>Hello</h1>');
|
|
||||||
const content = popup.document.querySelector('h1').innerText;
|
|
||||||
ipcRenderer.send('answer', content);
|
|
||||||
},
|
|
||||||
'file': () => {
|
|
||||||
const popup = window.open('native-window-open-child.html');
|
|
||||||
popup.onload = () => {
|
|
||||||
const content = popup.document.querySelector('h1').innerText;
|
|
||||||
ipcRenderer.send('answer', content);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
'native-addon': () => {
|
|
||||||
const runas = require('runas');
|
|
||||||
ipcRenderer.send('answer', typeof runas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const test = location.hash.slice(1);
|
|
||||||
if (tests.hasOwnProperty(test)) {
|
|
||||||
tests[test]();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue