Commit f1502845 f15028450f23a97cab2133b811f98f53bd520e01 by Nicolas Perriault

added Casper#createStep for easily create step functions with options

1 parent 061a8f8a
Showing 1 changed file with 15 additions and 5 deletions
......@@ -228,6 +228,18 @@
},
/**
* Creates a step definition.
*
* @param Function fn The step function to call
* @param Object options Step options
* @return Function The final step function
*/
createStep: function(fn, options) {
fn.options = isType(options, "object") ? options : {};
return fn;
},
/**
* Logs the HTML code of the current page.
*
* @return Casper
......@@ -748,13 +760,11 @@
* @see Casper#open
*/
thenOpen: function(location, then) {
var step = function(self) {
this.then(this.createStep(function(self) {
self.open(location);
};
step.options = {
}, {
skipLog: true
};
this.then(step);
}));
return isType(then, "function") ? this.then(then) : this;
},
......