| Index: third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ade9be9701c2be3379ff1afda6a8c29ec117b15a
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html
|
| @@ -0,0 +1,49 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<title>InputEvent: beforeinput inputType</title>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +</head>
|
| +<body>
|
| +<div id="log"></div>
|
| +<input type="text" id="txt">
|
| +
|
| +<script>
|
| +test(function() {
|
| + var lastInputType = "";
|
| + var txt = document.getElementById('txt');
|
| + txt.addEventListener('beforeinput', function(e) {
|
| + lastInputType = e.inputType;
|
| + });
|
| + if (!window.eventSender) {
|
| + document.write('This test requires eventSender');
|
| + } else {
|
| + function testKeyDownInputType(key, modifiers, inputType) {
|
| + eventSender.keyDown(key, modifiers);
|
| + assert_equals(lastInputType, inputType, modifiers.toString() + "+" + key + " should produce inputType:" + inputType);
|
| + }
|
| +
|
| + txt.focus();
|
| + // Typing
|
| + testKeyDownInputType('a', [], 'insertText');
|
| + testKeyDownInputType('6', [], 'insertText');
|
| + testKeyDownInputType('backspace', [], 'DeleteBackward');
|
| + testKeyDownInputType('l', ['shiftKey'], 'insertText');
|
| + testKeyDownInputType('w', ['shiftKey'], 'insertText');
|
| +
|
| + // Keyboard commands
|
| + var ctrlKey = (navigator.userAgent.indexOf('Mac OS X') != -1) ? 'metaKey' : 'ctrlKey';
|
| + testKeyDownInputType('z', [ctrlKey], 'Undo');
|
| + testKeyDownInputType('z', [ctrlKey, 'shiftKey'], 'Redo');
|
| + testKeyDownInputType('leftArrow', [], 'MoveLeft');
|
| + testKeyDownInputType('leftArrow', ['shiftKey'], 'MoveLeftAndModifySelection');
|
| + testKeyDownInputType('c', [ctrlKey], 'Copy');
|
| + testKeyDownInputType('v', [ctrlKey], 'Paste');
|
| + testKeyDownInputType('home', [], 'MoveToBeginningOfLine');
|
| + }
|
| +}, "Testing beforeinput inputType");
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|