bf7698e8f8
Introduce page.keyboard to provide low-level access to the keyboard.
21 lines
581 B
JavaScript
21 lines
581 B
JavaScript
test(function () {
|
|
var webpage = require('webpage');
|
|
|
|
var page = webpage.create();
|
|
|
|
page.evaluate(function() {
|
|
window.addEventListener('keydown', function(event) {
|
|
window.loggedEvent = window.loggedEvent || [];
|
|
window.loggedEvent.push(event.which);
|
|
}, false);
|
|
});
|
|
|
|
page.sendEvent('keydown', page.event.key.A);
|
|
var loggedEvent = page.evaluate(function() {
|
|
return window.loggedEvent;
|
|
});
|
|
|
|
assert_equals(loggedEvent.length, 1);
|
|
assert_equals(loggedEvent[0], page.event.key.A);
|
|
}, "key-down events");
|