Commit 1a946795 1a946795cb399421851c2c756362e509fbce56e4 by Nicolas Perriault

added tests for popups opened with target=_blank links

1 parent 3bb07c1d
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 </head> 6 </head>
7 <a href="." class="close">close</a> 7 <a href="." class="close">close</a>
8 <body> 8 <body>
9 <a href="/tests/site/form.html" target="_blank">new window</a>
9 <script> 10 <script>
10 var w = window.open("http://localhost:54321/tests/site/index.html", 11 var w = window.open("http://localhost:54321/tests/site/index.html",
11 "popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300"); 12 "popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300");
......
...@@ -65,12 +65,22 @@ casper.thenClick('.close', function() { ...@@ -65,12 +65,22 @@ casper.thenClick('.close', function() {
65 this.test.assertUrlMatches(/popup\.html$/, 65 this.test.assertUrlMatches(/popup\.html$/,
66 'Casper.withPopup() has reverted to main page after using the popup'); 66 'Casper.withPopup() has reverted to main page after using the popup');
67 this.test.assertEquals(this.popups.length, 0, 'Popup is removed when closed'); 67 this.test.assertEquals(this.popups.length, 0, 'Popup is removed when closed');
68 this.removeAllListeners('popup.created');
69 this.removeAllListeners('popup.loaded');
70 this.removeAllListeners('popup.closed');
71 });
72
73 casper.thenClick('a[target="_blank"]');
74
75 casper.waitForPopup('form.html', function() {
76 this.test.pass('Casper.waitForPopup() waits when clicked on a link with target=_blank');
77 });
78
79 casper.withPopup('form.html', function() {
80 this.test.assertTitle('CasperJS test form');
68 }); 81 });
69 82
70 casper.run(function() { 83 casper.run(function() {
71 // removes event listeners as they've now been tested already 84 // removes event listeners as they've now been tested already
72 this.removeAllListeners('popup.created'); 85 this.test.done(25);
73 this.removeAllListeners('popup.loaded');
74 this.removeAllListeners('popup.closed');
75 this.test.done(23);
76 }); 86 });
......