Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
db27f288
...
db27f28865bffe846835bcd75626728f8ba5538c
authored
2012-06-09 08:52:35 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed ua tests were triggering unneeded events
1 parent
02d6f057
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
tests/suites/casper/agent.js
tests/suites/casper/agent.js
View file @
db27f28
...
...
@@ -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
();
});
...
...
Please
register
or
sign in
to post a comment