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 @@ ...@@ -32,6 +32,9 @@
32 results.test4 = true; 32 results.test4 = true;
33 event.preventDefault(); 33 event.preventDefault();
34 }; 34 };
35 document.querySelector('#test5').onclick = function(event) {
36 results.testclick = [event.clientX, event.clientY];
37 };
35 window.onmousedown = function(event) { 38 window.onmousedown = function(event) {
36 results.testdown = [event.clientX, event.clientY]; 39 results.testdown = [event.clientX, event.clientY];
37 }; 40 };
...@@ -51,6 +54,9 @@ ...@@ -51,6 +54,9 @@
51 test5elem.addEventListener('mouseup', function(event) { 54 test5elem.addEventListener('mouseup', function(event) {
52 results.test5.push('mouseup'); 55 results.test5.push('mouseup');
53 }); 56 });
57 test5elem.addEventListener('click', function(event) {
58 results.test5.push('click');
59 });
54 document.querySelector('#test6').onclick = function(event) { 60 document.querySelector('#test6').onclick = function(event) {
55 results.test6 = true; 61 results.test6 = true;
56 event.preventDefault(); 62 event.preventDefault();
......
...@@ -111,7 +111,7 @@ casper.test.begin('element focus on click', 1, function(test) { ...@@ -111,7 +111,7 @@ casper.test.begin('element focus on click', 1, function(test) {
111 }); 111 });
112 }); 112 });
113 113
114 casper.test.begin('mouse events on click', 2, function(test) { 114 casper.test.begin('mouse events on click', 3, function(test) {
115 casper.start('tests/site/click.html', function() { 115 casper.start('tests/site/click.html', function() {
116 this.click('#test5'); 116 this.click('#test5');
117 }).then(function() { 117 }).then(function() {
...@@ -120,6 +120,8 @@ casper.test.begin('mouse events on click', 2, function(test) { ...@@ -120,6 +120,8 @@ casper.test.begin('mouse events on click', 2, function(test) {
120 'Casper.click() triggers mousedown event'); 120 'Casper.click() triggers mousedown event');
121 test.assert(results.test5.indexOf('mouseup') !== -1, 121 test.assert(results.test5.indexOf('mouseup') !== -1,
122 'Casper.click() triggers mouseup event'); 122 'Casper.click() triggers mouseup event');
123 test.assert(results.test5.indexOf('click') !== -1,
124 'Casper.click() triggers click event');
123 }).run(function() { 125 }).run(function() {
124 test.done(); 126 test.done();
125 }); 127 });
......