Commit db27f288 db27f28865bffe846835bcd75626728f8ba5538c by Nicolas Perriault

fixed ua tests were triggering unneeded events

1 parent 02d6f057
......@@ -4,12 +4,21 @@ function testUA(ua, match) {
);
}
testUA(casper.options.pageSettings.userAgent, /CasperJS/);
casper.start().userAgent('plop').on('resource.requested', function(request) {
function fetchUA(request) {
testUA(request.headers.filter(function(header) {
return header.name === "User-Agent";
}).pop().value, /plop/);
}).start('tests/site/index.html').run(function() {
}
testUA(casper.options.pageSettings.userAgent, /CasperJS/);
casper.start();
casper.userAgent('plop').on('resource.requested', fetchUA);
casper.thenOpen('tests/site/index.html');
casper.run(function() {
this.removeListener('resource.requested', fetchUA);
this.test.done();
});
......