Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..29296bcd8de55c19b993dca3a3f89d58e2d78d15 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html |
| @@ -0,0 +1,41 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<title>InputEvent: beforeinput order on typing and command</title> |
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +</head> |
| +<body> |
| +<input type="text" id="txt"> |
| +<script> |
| +test(function() { |
| + var eventList = ['keydown', 'keypress', 'beforeinput', 'input', 'keyup']; |
| + var expectedEventOrder = [ |
| + // Pressing 'a'. |
| + 'keydown', 'keypress', 'beforeinput', 'input', 'keyup', |
| + // Pressing Ctrl+z, eventSender.keyDown won't send 'keydown' and 'keyup' for Ctrl. |
| + /*'keydown',*/ 'keydown', 'beforeinput', 'input', 'keyup', /*'keyup',*/ |
| + ]; |
| + var actualEventOrder = []; |
| + var txt = document.getElementById('txt'); |
| + eventList.forEach(function(eventType) { |
| + txt.addEventListener(eventType, function(e) { |
|
yosin_UTC9
2016/04/13 06:13:09
nit: Please avoid to use single-letter variable na
chongz
2016/04/13 23:53:08
Done.
|
| + actualEventOrder.push(e.type); |
| + }); |
| + }); |
| + if (!window.eventSender) { |
| + document.write('This test requires eventSender'); |
| + } else { |
| + txt.focus(); |
| + eventSender.keyDown('a'); |
| + var isMacOSX = navigator.userAgent.indexOf('Mac OS X') != -1; |
| + if (!isMacOSX) { |
| + // MacOS's eventSender does not work on hot keys other than arrows. |
| + eventSender.keyDown('z', ['ctrlKey']); |
| + assert_array_equals(actualEventOrder, expectedEventOrder, actualEventOrder.toString()); |
| + } |
| + } |
| +}, "Testing beforeinput order on typing and command"); |
|
yosin_UTC9
2016/04/13 06:13:09
Please use single-quote in script fragment since o
chongz
2016/04/13 23:53:08
Done.
|
| +</script> |
| +</body> |
| +</html> |