Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html |
| diff --git a/third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html b/third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e0ccc38dd45e8cef2d07913d620720d79f7de42f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html |
| @@ -0,0 +1,36 @@ |
| +<!doctype html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../assert_selection.js"></script> |
| +<script> |
| +test(() => { |
| + if (!window.eventSender) { |
| + assert_unreached('This test requires eventSender.'); |
| + return; |
| + } |
| + |
| + assert_selection( |
| + '<input value="x"><input type="checkbox">', |
| + selection => { |
| + const document = selection.document; |
| + const textField = document.querySelector('input'); |
| + textField.select(); |
| + document.querySelector('input[type=checkbox]').focus(); |
| + eventSender.keyDown('a'); |
| + // Insert |textField.value| to HTML for verification |
|
Xiaocheng
2017/01/12 08:31:02
I think we should modify assert_selection to repor
yoichio
2017/01/13 02:04:07
If assert_selection won't be used to test such
i
|
| + textField.appendChild(document.createTextNode(textField.value)); |
| + }, |
| + '<input value="x">x</input><input type="checkbox">', |
| + 'unfocused text field should not insert a charcter by keyboard event'); |
| + |
| + assert_selection( |
| + '<div contenteditable>|</div><input type="checkbox">', |
| + selection => { |
| + const document = selection.document; |
| + document.querySelector('input[type=checkbox]').focus(); |
| + eventSender.keyDown('a'); |
| + }, |
| + '<div contenteditable>|</div><input type="checkbox">', |
| + 'unfocused content editable should not insert a charcter by keyboard event'); |
| + }, 'Keyboard event without focus should not insert a character.'); |
| +</script> |