Skip to content

Commit b08ad4f

Browse files
committed
add test caset "quit_with_secondary_window_on_top"
1 parent 1860bea commit b08ad4f

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>quit with secondary window on top test</title>
6+
</head>
7+
<body>
8+
<p>quit with secondary window on top test</p>
9+
10+
<script src="../res/mocha_util.js"></script>
11+
<script src="mocha_test.js"></script>
12+
13+
</body>
14+
15+
</html>
16+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>quit_with_secondary_window_on_top!</title>
5+
</head>
6+
<body>
7+
<h1>quit_with_secondary_window_on_top!</h1>
8+
with the created new window on top, hit CMD-Q or select Menu > Quit
9+
<script>
10+
var gui = require('nw.gui');
11+
var win1 = gui.Window.open('index1.html');
12+
setTimeout(function() {
13+
win1.focus();
14+
}, 1000);
15+
</script>.
16+
</body>
17+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>New Window!</title>
5+
</head>
6+
<body>
7+
<h1>New Window!</h1>
8+
We are using node.js
9+
<script>
10+
var gui = require('nw.gui');
11+
var win = gui.Window.get();
12+
win.on('focus', function() {
13+
gui.App.closeAllWindows();
14+
});
15+
16+
</script>
17+
</body>
18+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "nw-quit_with_secondary_window_on_top",
3+
"main": "index.html"
4+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
var assert = require('assert');
2+
var path = require('path');
3+
var exec = require('child_process').exec;
4+
var spawn = require('child_process').spawn;
5+
var os = require('os');
6+
var fs = require('fs-extra');
7+
var curDir = fs.realpathSync('.');
8+
9+
var result;
10+
11+
if (os.platform() === 'darwin') {
12+
13+
describe('quit_with_secondary_window_on_top', function() {
14+
before(function(done) {
15+
this.timeout(0);
16+
var app_path = path.join(curDir, 'internal');
17+
var exec_path = process.execPath;
18+
exec_path = exec_path.replace(/ /g, '\\ ');
19+
exec(exec_path + ' ' + app_path, function(error, stdout, stderr) {
20+
result = error;
21+
done();
22+
});
23+
})
24+
it('should quit with secondary window on top without error', function() {
25+
assert.equal(result, null);
26+
});
27+
});
28+
29+
} else {
30+
console.log('This test need to run under darwin');
31+
describe('quit_with_secondary_window_on_top', function() {
32+
33+
it('should quit with secondary window on top without error', function() {
34+
// todo
35+
});
36+
});
37+
38+
}
39+
40+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name":"quit_with_secondary_window_on_top_wrapper",
3+
"main":"index.html"
4+
}
5+

0 commit comments

Comments
 (0)