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
d306b927
...
d306b927bcb113ea80a75544d3970acfa8c7bf92
authored
2014-03-08 11:38:03 -0600
by
Trent Ohannessian
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added a test for click emit
Added a test for click emit
1 parent
f8f51357
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
tests/site/click.html
tests/suites/casper/click.js
tests/site/click.html
View file @
d306b92
...
...
@@ -32,6 +32,9 @@
results
.
test4
=
true
;
event
.
preventDefault
();
};
document
.
querySelector
(
'#test5'
).
onclick
=
function
(
event
)
{
results
.
testclick
=
[
event
.
clientX
,
event
.
clientY
];
};
window
.
onmousedown
=
function
(
event
)
{
results
.
testdown
=
[
event
.
clientX
,
event
.
clientY
];
};
...
...
@@ -51,6 +54,9 @@
test5elem
.
addEventListener
(
'mouseup'
,
function
(
event
)
{
results
.
test5
.
push
(
'mouseup'
);
});
test5elem
.
addEventListener
(
'click'
,
function
(
event
)
{
results
.
test5
.
push
(
'click'
);
});
document
.
querySelector
(
'#test6'
).
onclick
=
function
(
event
)
{
results
.
test6
=
true
;
event
.
preventDefault
();
...
...
tests/suites/casper/click.js
View file @
d306b92
...
...
@@ -111,7 +111,7 @@ casper.test.begin('element focus on click', 1, function(test) {
});
});
casper
.
test
.
begin
(
'mouse events on click'
,
2
,
function
(
test
)
{
casper
.
test
.
begin
(
'mouse events on click'
,
3
,
function
(
test
)
{
casper
.
start
(
'tests/site/click.html'
,
function
()
{
this
.
click
(
'#test5'
);
}).
then
(
function
()
{
...
...
@@ -120,6 +120,8 @@ casper.test.begin('mouse events on click', 2, function(test) {
'Casper.click() triggers mousedown event'
);
test
.
assert
(
results
.
test5
.
indexOf
(
'mouseup'
)
!==
-
1
,
'Casper.click() triggers mouseup event'
);
test
.
assert
(
results
.
test5
.
indexOf
(
'click'
)
!==
-
1
,
'Casper.click() triggers click event'
);
}).
run
(
function
()
{
test
.
done
();
});
...
...
Please
register
or
sign in
to post a comment