OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script src="../assert_selection.js"></script> | |
5 <script> | |
6 test(() => { | |
7 if (!window.eventSender) { | |
8 assert_unreached('This test requires eventSender.'); | |
9 return; | |
10 } | |
11 | |
12 assert_selection( | |
13 '<input value="x"><input type="checkbox">', | |
14 selection => { | |
15 const document = selection.document; | |
16 const textField = document.querySelector('input'); | |
17 textField.select(); | |
18 document.querySelector('input[type=checkbox]').focus(); | |
19 eventSender.keyDown('a'); | |
20 // 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
| |
21 textField.appendChild(document.createTextNode(textField.value)); | |
22 }, | |
23 '<input value="x">x</input><input type="checkbox">', | |
24 'unfocused text field should not insert a charcter by keyboard event'); | |
25 | |
26 assert_selection( | |
27 '<div contenteditable>|</div><input type="checkbox">', | |
28 selection => { | |
29 const document = selection.document; | |
30 document.querySelector('input[type=checkbox]').focus(); | |
31 eventSender.keyDown('a'); | |
32 }, | |
33 '<div contenteditable>|</div><input type="checkbox">', | |
34 'unfocused content editable should not insert a charcter by keyboard event') ; | |
35 }, 'Keyboard event without focus should not insert a character.'); | |
36 </script> | |
OLD | NEW |