puppeteer/third_party/phantomjs/test/module/webpage/keyup-event.js

22 lines
591 B
JavaScript
Raw Normal View History

2017-05-11 07:06:41 +00:00
//! unsupported
test(function () {
var webpage = require('webpage');
var page = webpage.create();
page.evaluate(function() {
window.addEventListener('keyup', function(event) {
window.loggedEvent = window.loggedEvent || [];
window.loggedEvent.push(event);
}, false);
});
page.sendEvent('keyup', page.event.key.B);
var loggedEvent = page.evaluate(function() {
return window.loggedEvent;
});
assert_equals(loggedEvent.length, 1);
assert_equals(loggedEvent[0].which, page.event.key.B);
}, "key-up events");