Skip to content

Commit b006639

Browse files
committed
Merge pull request nwjs#958 from richardcypher/focus
[test]add nwjs#933 (focus) to (manual) test cases
2 parents 6945c28 + f457d81 commit b006639

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

tests/manual_tests/focus/1.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello 1

tests/manual_tests/focus/2.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello 2

tests/manual_tests/focus/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<html>
2+
<head>
3+
<title>Hello World!</title>
4+
<script>
5+
var gui = require('nw.gui');
6+
var win1 = gui.Window.open('1.html');
7+
var win2 = gui.Window.open('2.html');
8+
var i = 0;
9+
10+
setInterval(function() {
11+
if (i % 2 == 0) {
12+
win1.focus();
13+
} else {
14+
win2.focus();
15+
}
16+
i++;
17+
}, 1000);
18+
win1.on('focus',function(){
19+
console.log('win1 focus');
20+
})
21+
win2.on('focus',function(){
22+
console.log('win2 focus');
23+
})
24+
</script>
25+
</head>
26+
<body>
27+
<h1>Hello World!</h1>
28+
</body>
29+
</html>

tests/manual_tests/focus/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "nw-demo",
3+
"main": "index.html"
4+
}

0 commit comments

Comments
 (0)