Add test for opeing HTML file

This commit is contained in:
Ryohei Ikegami 2017-04-04 19:05:13 +09:00
parent 3eab5df4a4
commit 051e133ce3
3 changed files with 36 additions and 11 deletions

View file

@ -0,0 +1 @@
<h1>Hello</h1>

View file

@ -2,10 +2,25 @@
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require("electron");
const otherWin = window.open();
otherWin.document.write("<h1>Hello</h1>");
const content = otherWin.document.querySelector("h1").innerText;
ipcRenderer.send('answer', content);
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);
};
}
}
const test = location.hash.slice(1);
if (tests.hasOwnProperty(test)) {
tests[test]();
}
</script>
</body>
</html>