Commit d306b927 d306b927bcb113ea80a75544d3970acfa8c7bf92 by Trent Ohannessian

Added a test for click emit

Added a test for click emit
1 parent f8f51357
......@@ -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();
......
......@@ -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();
});
......