Commit 8168fe03 8168fe03521cbace2af5e38ebd5feccbe70dc306 by Nicolas Perriault

added tests for Casper.viewport()

1 parent 47b368be
...@@ -49,7 +49,15 @@ casper.start('tests/site/index.html', function(self) { ...@@ -49,7 +49,15 @@ casper.start('tests/site/index.html', function(self) {
49 49
50 casper.test.assert(casper.steps.length === 1, 'start() can add a new navigation step'); 50 casper.test.assert(casper.steps.length === 1, 'start() can add a new navigation step');
51 51
52 // Casper.viewport()
53 casper.test.comment('viewport');
54 casper.viewport({width: 1337, height: 999});
55 casper.test.assertEquals(casper.page.viewportSize.width, 1337, 'Casper.viewport() can change the width of the viewport');
56 casper.test.assertEquals(casper.page.viewportSize.height, 999, 'Casper.viewport() can change the height of the viewport');
57 casper.test.assertRaises(casper.viewport, 'booh', 'Casper.viewport() validates viewport size data');
58
52 // Casper#then() 59 // Casper#then()
60 casper.test.comment('then');
53 casper.then(function(self) { 61 casper.then(function(self) {
54 self.test.assertTitle('CasperJS test target', 'click() casper can click on a text link and react when it is loaded 1/2'); 62 self.test.assertTitle('CasperJS test target', 'click() casper can click on a text link and react when it is loaded 1/2');
55 self.click('a[href="form.html"]'); 63 self.click('a[href="form.html"]');
...@@ -126,6 +134,7 @@ casper.then(function(self) { ...@@ -126,6 +134,7 @@ casper.then(function(self) {
126 }); 134 });
127 135
128 // Casper#each() 136 // Casper#each()
137 casper.test.comment('each');
129 casper.each([1, 2, 3], function(self, item, i) { 138 casper.each([1, 2, 3], function(self, item, i) {
130 self.test.assertEquals(i, item - 1, 'each() passes a contextualized index'); 139 self.test.assertEquals(i, item - 1, 'each() passes a contextualized index');
131 }); 140 });
......