puppeteer/third_party/phantomjs/test/module/webpage/mousemove-event.js
JoelEinbinder 98ee35655f Mouse (#101)
This patch:
- adds Mouse class which holds mouse state and implements mouse primitives,
such as moving, button down and button up.
- implements high-level mouse api, such as `page.click` and `page.hover`.

References #40, References #89
2017-07-21 20:29:31 -07:00

19 lines
624 B
JavaScript

test(function () {
var page = require('webpage').create();
page.evaluate(function() {
window.addEventListener('mousemove', function(event) {
window.loggedEvent = window.loggedEvent || [];
window.loggedEvent.push({clientX: event.clientX, clientY: event.clientY});
}, false);
});
page.sendEvent('mousemove', 14, 3);
var loggedEvent = page.evaluate(function() {
return window.loggedEvent;
});
assert_equals(loggedEvent.length, 1);
assert_equals(loggedEvent[0].clientX, 14);
assert_equals(loggedEvent[0].clientY, 3);
}, "mouse-move events");