Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html

Issue 2616623002: Do not send redundant selectionchange-events (decouple focus) (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../assert_selection.js"></script> 4 <script src="../assert_selection.js"></script>
5 <script> 5 <script>
6 test(() => { 6 test(() => {
7 if (!window.eventSender) { 7 if (!window.eventSender) {
8 assert_unreached('This test requires eventSender.'); 8 assert_unreached('This test requires eventSender.');
9 return; 9 return;
10 } 10 }
11 11
12 assert_selection( 12 assert_selection(
13 '<input value="x"><input type="checkbox">', 13 '<input value="x"><input type="checkbox">',
14 selection => { 14 selection => {
15 const document = selection.document; 15 const document = selection.document;
16 const textField = document.querySelector('input'); 16 const textField = document.querySelector('input');
17 textField.select(); 17 textField.select();
18 document.querySelector('input[type=checkbox]').focus(); 18 document.querySelector('input[type=checkbox]').focus();
19 eventSender.keyDown('a'); 19 eventSender.keyDown('a');
20 // Insert |textField.value| to HTML for verification 20 // Insert |textField.value| to HTML for verification
21 textField.appendChild(document.createTextNode(textField.value)); 21 textField.appendChild(document.createTextNode(textField.value));
22 }, 22 },
23 '<input value="x">x</input><input type="checkbox">', 23 '|<input value="x">x</input><input type="checkbox">',
24 'unfocused text field should not insert a charcter by keyboard event'); 24 'unfocused text field should not insert a charcter by keyboard event');
25 25
26 assert_selection( 26 assert_selection(
27 '<div contenteditable>|</div><input type="checkbox">', 27 '<div contenteditable>|</div><input type="checkbox">',
28 selection => { 28 selection => {
29 const document = selection.document; 29 const document = selection.document;
30 document.querySelector('input[type=checkbox]').focus(); 30 document.querySelector('input[type=checkbox]').focus();
31 eventSender.keyDown('a'); 31 eventSender.keyDown('a');
32 }, 32 },
33 '<div contenteditable>|</div><input type="checkbox">', 33 '<div contenteditable>|</div><input type="checkbox">',
34 'unfocused content editable should not insert a charcter by keyboard event') ; 34 'unfocused content editable should not insert a charcter by keyboard event') ;
35 }, 'Keyboard event without focus should not insert a character.'); 35 }, 'Keyboard event without focus should not insert a character.');
36 </script> 36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698