forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
57 lines (48 loc) · 1.34 KB
/
index.html
File metadata and controls
57 lines (48 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test Case for 'Window.focus'</title>
<script>
var gui = require('nw.gui');
var win = gui.Window.get();
var win_c = new Array();
var win2_clicked = false, win1_clicked = false;
for (var i = 0; i < 3; i++)
win_c[i] = 0;
localStorage.win1 = 0;
var win1 = gui.Window.open('index1.html', {
'new-instance': true
});
var win2 = gui.Window.open('index2.html');
win.on('focus', function() {
console.log('win');
win_c[0]++;
});
win2.on('focus', function() {
console.log('win2');
win_c[2]++;
win2_clicked = true;
});
function focus1() {
win1_clicked = true;
win_c[1] = localStorage.win1;
}
function done() {
if (win1_clicked && win2_clicked) {
var client = require('../../nw_test_app').createClient({
argv: gui.App.argv,
data: win_c
});
} else
setTimeout(done, 2000);
}
done();
</script>
</head>
<body>
<p id="wait" style="font-size:1.5em">For now you should manually click the button to test the case</p>
<button onclick="focus1()">You should click this only after you focused win1</button>
<button onclick="win2.focus()">win2 Focus</button>
</body>
</html>