Permalink
Browse files

Adding test for sendEvent with modifier key

  • Loading branch information...
1 parent f402a8d commit 380c56e67245cd1c0f11deeed37d20b5e7dfe5e3 @jimevans jimevans committed with Oct 24, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/webpage-spec.js
View
@@ -264,6 +264,23 @@ describe("WebPage object", function() {
document.querySelector('input').focus();
});
page.sendEvent('keypress', "ABCD");
+ // 0x02000000 is the Shift modifier.
+ page.sendEvent('keypress', page.event.key.Home, null, null, 0x02000000);
+ page.sendEvent('keypress', page.event.key.Delete);
+ var text = page.evaluate(function() {
+ return document.querySelector('input').value;
+ });
+ expect(text).toEqual("");
+ });
+ });
+
+ it("should handle key events with modifier keys", function() {
+ runs(function() {
+ page.content = '<input type="text">';
+ page.evaluate(function() {
+ document.querySelector('input').focus();
+ });
+ page.sendEvent('keypress', "ABCD");
var text = page.evaluate(function() {
return document.querySelector('input').value;
});

0 comments on commit 380c56e

Please sign in to comment.