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

Unified Diff: third_party/WebKit/LayoutTests/editing/input/keyboard_event_without_focus.html

Issue 2628763003: Keyboard event should not insert a character at selection if selection doesn't have focus (Closed)
Patch Set: 2017-01-12T13:25:32 Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/keypress-focus-change.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/keypress-focus-change.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698