tikiwiki/packages/tiki-pkg-casperjs/jerome-breton/casperjs/tests/suites/casper/callutils.js
2023-11-20 20:52:04 +00:00

23 lines
742 B
JavaScript
Executable File

/*eslint strict:0*/
casper.test.begin('Casper.callUtils()', 2, function(test) {
casper.start("tests/site/index.html", function(){
this.evaluate(function() {
/*global __utils__*/
__utils__.testCallUtils = function() {
return [].slice.call(arguments);
};
});
test.assertEquals(casper.callUtils("testCallUtils", "a", "b", "c"),
["a", "b", "c"],
"Casper.callUtils() invokes a client side utility");
test.assertThrows(casper.callUtils, ["xxx", "a", "b", "c"],
"Casper.callUtils() raises an error if used inappropriately");
});
casper.run(function() {
test.done();
});
});