Commit 52a67cb5 52a67cb5a21b03c05870755c276be80777c931e0 by Nicolas Perriault

fixed no error was raised if Casper.viewport() was called before casper having been started

1 parent 063ddf76
...@@ -881,6 +881,9 @@ ...@@ -881,6 +881,9 @@
881 * @return Casper 881 * @return Casper
882 */ 882 */
883 viewport: function(width, height) { 883 viewport: function(width, height) {
884 if (!this.started) {
885 throw new Error("Casper must be started in order to set viewport at runtime");
886 }
884 if (!isType(width, "number") || !isType(height, "number") || width <= 0 || height <= 0) { 887 if (!isType(width, "number") || !isType(height, "number") || width <= 0 || height <= 0) {
885 throw new Error("Invalid viewport width/height set: " + width + 'x' + height); 888 throw new Error("Invalid viewport width/height set: " + width + 'x' + height);
886 } 889 }
......