Commit 998da82a 998da82aa160d039ba8093f2e122791a10e42788 by Laurent Jouanneau

Fixes some tests for Gecko

- skip tests about javascript: links, because they are executed asynchronously
  so tests about them fails.
- event.x and event.y don't exist in Gecko. The standard way is event.clientX
  and event.clientY
1 parent 32fd8684
...@@ -29,16 +29,16 @@ ...@@ -29,16 +29,16 @@
29 event.preventDefault(); 29 event.preventDefault();
30 }; 30 };
31 window.onmousedown = function(event) { 31 window.onmousedown = function(event) {
32 results.testdown = [event.x, event.y]; 32 results.testdown = [event.clientX, event.clientY];
33 }; 33 };
34 window.onmouseup = function(event) { 34 window.onmouseup = function(event) {
35 results.testup = [event.x, event.y]; 35 results.testup = [event.clientX, event.clientY];
36 }; 36 };
37 window.onmousemove = function(event) { 37 window.onmousemove = function(event) {
38 results.testmove = [event.x, event.y]; 38 results.testmove = [event.clientX, event.clientY];
39 }; 39 };
40 window.ondblclick = function(event) { 40 window.ondblclick = function(event) {
41 results.testdoubleclick = [event.x, event.y]; 41 results.testdoubleclick = [event.clientX, event.clientY];
42 }; 42 };
43 var test5elem = document.querySelector('#test5'); 43 var test5elem = document.querySelector('#test5');
44 test5elem.addEventListener('mousedown', function(event) { 44 test5elem.addEventListener('mousedown', function(event) {
......
...@@ -21,6 +21,11 @@ casper.test.begin('onclick variants tests', 8, function(test) { ...@@ -21,6 +21,11 @@ casper.test.begin('onclick variants tests', 8, function(test) {
21 test.assert(this.click('#test3'), 'Casper.click() can click an `onclick=".*; return false"` link'); 21 test.assert(this.click('#test3'), 'Casper.click() can click an `onclick=".*; return false"` link');
22 test.assert(this.click('#test4'), 'Casper.click() can click an unobstrusive js handled link'); 22 test.assert(this.click('#test4'), 'Casper.click() can click an unobstrusive js handled link');
23 var results = this.getGlobal('results'); 23 var results = this.getGlobal('results');
24 if (phantom.casperEngine == 'slimerjs') {
25 // "javascript:" link in Gecko are executed asynchronously, so we don't have result at this time
26 test.skip(1)
27 }
28 else
24 test.assert(results.test1, 'Casper.click() has clicked an `href="javascript:` link'); 29 test.assert(results.test1, 'Casper.click() has clicked an `href="javascript:` link');
25 test.assert(results.test2, 'Casper.click() has clicked an `href="#"` link'); 30 test.assert(results.test2, 'Casper.click() has clicked an `href="#"` link');
26 test.assert(results.test3, 'Casper.click() has clicked an `onclick=".*; return false"` link'); 31 test.assert(results.test3, 'Casper.click() has clicked an `onclick=".*; return false"` link');
...@@ -41,6 +46,11 @@ casper.test.begin('clickLabel tests tests', 8, function(test) { ...@@ -41,6 +46,11 @@ casper.test.begin('clickLabel tests tests', 8, function(test) {
41 test.assert(this.clickLabel('test4'), 46 test.assert(this.clickLabel('test4'),
42 'Casper.clickLabel() can click an unobstrusive js handled link'); 47 'Casper.clickLabel() can click an unobstrusive js handled link');
43 var results = this.getGlobal('results'); 48 var results = this.getGlobal('results');
49 if (phantom.casperEngine == 'slimerjs') {
50 // "javascript:" link in Gecko are executed asynchronously, so we don't have result at this time
51 test.skip(1)
52 }
53 else
44 test.assert(results.test1, 54 test.assert(results.test1,
45 'Casper.clickLabel() has clicked an `href="javascript:` link'); 55 'Casper.clickLabel() has clicked an `href="javascript:` link');
46 test.assert(results.test2, 56 test.assert(results.test2,
......