Chromium Code Reviews| 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 |
| index 478fa7a7767d33bc272220d0cc7bf2292174fd5b..2c60dd4074ba84c251452f058d4b339231bf1fd0 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html |
| +++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html |
| @@ -9,18 +9,24 @@ |
| <input type="text" id="txt"> |
| <script> |
| test(function() { |
| + var lastBeforeInputType = ''; |
| var lastInputType = ''; |
| var txt = document.getElementById('txt'); |
| txt.addEventListener('beforeinput', function(event) { |
| + lastBeforeInputType = event.inputType; |
| + }); |
| + txt.addEventListener('input', function(event) { |
|
chongz
2016/06/22 05:16:52
Actually there are bunch of existing 'input' event
|
| lastInputType = event.inputType; |
| }); |
| if (!window.eventSender) { |
| document.write('This test requires eventSender'); |
| } else { |
| - var kNoBeforeInputFired = 'noBeforeInputFired'; |
| + var kNoInputEventFired = 'noInputEventFired'; |
| function testKeyDownInputType(key, modifiers, inputType) { |
| - lastInputType = kNoBeforeInputFired; |
| + lastBeforeInputType = kNoInputEventFired; |
| + lastInputType = kNoInputEventFired; |
| eventSender.keyDown(key, modifiers); |
| + assert_equals(lastBeforeInputType, inputType, `${modifiers.toString()}+${key} should produce beforeInputType: ${inputType}`); |
| assert_equals(lastInputType, inputType, `${modifiers.toString()}+${key} should produce inputType: ${inputType}`); |
| } |
| @@ -40,9 +46,9 @@ test(function() { |
| testKeyDownInputType('z', ['ctrlKey', 'shiftKey'], 'redo'); |
| } |
| // Move command should not generate input events. |
| - testKeyDownInputType('leftArrow', [], kNoBeforeInputFired); |
| - testKeyDownInputType('leftArrow', ['shiftKey'], kNoBeforeInputFired); |
| - testKeyDownInputType('home', [], kNoBeforeInputFired); |
| + testKeyDownInputType('leftArrow', [], kNoInputEventFired); |
| + testKeyDownInputType('leftArrow', ['shiftKey'], kNoInputEventFired); |
| + testKeyDownInputType('home', [], kNoInputEventFired); |
| } |
| }, 'Testing beforeinput inputType'); |
| </script> |