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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html

Issue 2768303003: [InputEvent] Allow transpose and yank in plain-text field (Closed)
Patch Set: Created 3 years, 9 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
Index: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html
index dcc027b493c9fc5aed8eb2a55ec7caecc00c94c1..0a9fb6f164317d87a31b2210ceacc022a426f1cc 100644
--- a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-yank.html
@@ -2,6 +2,7 @@
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="editable" contenteditable></div>
+<textarea id="txt"></textarea>
<script>
test(() => {
assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.');
@@ -30,5 +31,34 @@ test(() => {
testRunner.execCommand('yank');
assert_equals(editable.innerHTML, 'abc');
assert_equals(eventRecorder, 'beforeinput-insertFromYank-abc-input-insertFromYank-abc-');
-});
+}, 'Yank on contenteditable');
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.');
+ assert_not_equals(window.testRunner, undefined, 'This test requires testRunner.');
+
+ let eventRecorder = '';
+ document.addEventListener('beforeinput', event => {
+ eventRecorder += `beforeinput-${event.inputType}-${event.data}-`;
+ });
+ document.addEventListener('input', event => {
+ eventRecorder += `input-${event.inputType}-${event.data}-`;
+ });
+
+ const txt = document.getElementById('txt');
+ txt.value = 'abc';
+ txt.focus();
+ txt.setSelectionRange(3, 3); // End of first line.
+
+ // Delete a word to setup kill buffer.
+ eventSender.keyDown('Backspace', ['altKey']);
+ assert_equals(txt.value, '');
+
+ // Test Yank.
+ testRunner.execCommand('undo'); // Execute undo to close last typing command.
+ eventRecorder = '';
+ testRunner.execCommand('yank');
+ assert_equals(txt.value, 'abc');
+ assert_equals(eventRecorder, 'beforeinput-insertFromYank-abc-input-insertFromYank-abc-');
+}, 'Yank on <textarea>');
</script>

Powered by Google App Engine
This is Rietveld 408576698