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 @@
event.preventDefault();
};
window.onmousedown = function(event) {
results.testdown = [event.x, event.y];
results.testdown = [event.clientX, event.clientY];
};
window.onmouseup = function(event) {
results.testup = [event.x, event.y];
results.testup = [event.clientX, event.clientY];
};
window.onmousemove = function(event) {
results.testmove = [event.x, event.y];
results.testmove = [event.clientX, event.clientY];
};
window.ondblclick = function(event) {
results.testdoubleclick = [event.x, event.y];
results.testdoubleclick = [event.clientX, event.clientY];
};
var test5elem = document.querySelector('#test5');
test5elem.addEventListener('mousedown', function(event) {
......
......@@ -21,7 +21,12 @@ casper.test.begin('onclick variants tests', 8, function(test) {
test.assert(this.click('#test3'), 'Casper.click() can click an `onclick=".*; return false"` link');
test.assert(this.click('#test4'), 'Casper.click() can click an unobstrusive js handled link');
var results = this.getGlobal('results');
test.assert(results.test1, 'Casper.click() has clicked an `href="javascript:` link');
if (phantom.casperEngine == 'slimerjs') {
// "javascript:" link in Gecko are executed asynchronously, so we don't have result at this time
test.skip(1)
}
else
test.assert(results.test1, 'Casper.click() has clicked an `href="javascript:` link');
test.assert(results.test2, 'Casper.click() has clicked an `href="#"` link');
test.assert(results.test3, 'Casper.click() has clicked an `onclick=".*; return false"` link');
test.assert(results.test4, 'Casper.click() has clicked an unobstrusive js handled link');
......@@ -41,8 +46,13 @@ casper.test.begin('clickLabel tests tests', 8, function(test) {
test.assert(this.clickLabel('test4'),
'Casper.clickLabel() can click an unobstrusive js handled link');
var results = this.getGlobal('results');
test.assert(results.test1,
'Casper.clickLabel() has clicked an `href="javascript:` link');
if (phantom.casperEngine == 'slimerjs') {
// "javascript:" link in Gecko are executed asynchronously, so we don't have result at this time
test.skip(1)
}
else
test.assert(results.test1,
'Casper.clickLabel() has clicked an `href="javascript:` link');
test.assert(results.test2,
'Casper.clickLabel() has clicked an `href="#"` link');
test.assert(results.test3,
......