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

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

Issue 2851363003: [InputEvent] Update EndingSelection when appending UndoStep (Closed)
Patch Set: yosin's comment: Use |start === undefined| Created 3 years, 7 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/Source/core/editing/Editor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-drag-drop.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-drag-drop.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-drag-drop.html
index 40769a55063ff6d136a486bf21ab80b1b0cf473d..52c640f4e44ffed30c6b7f858b08b24dfc0e351a 100644
--- a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-drag-drop.html
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-drag-drop.html
@@ -16,10 +16,17 @@ div {
<div id="editable2" contenteditable></div>
<textarea id="textarea1">Text</textarea>
<textarea id="barrier"></textarea>
+<input id="input_drag">
+<input id="input_drop">
<script>
-function simulateDragDrop(dragElement, dropElement) {
+function simulateDragDrop(dragElement, dropElement, start, end) {
if (dragElement.select) {
- dragElement.select();
+ if (start === undefined || end === undefined) {
+ dragElement.select();
+ } else {
+ dragElement.focus();
+ dragElement.setSelectionRange(start, end);
+ }
} else {
var selection = window.getSelection();
selection.collapse(dragElement, 0);
@@ -298,6 +305,27 @@ test(function() {
testRunner.execCommand('undo');
document.body.appendChild(editable1);
}, 'Testing element removed by event handler');
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined, 'This test requires eventSender.');
+ assert_not_equals(window.testRunner, undefined, 'This test requires testRunner.');
+
+ const input_drag = document.getElementById('input_drag');
+ const input_drop = document.getElementById('input_drop');
+
+ input_drag.value = '12345678';
+ input_drop.value = '4';
+
+ simulateDragDrop(input_drag, input_drop, 1, 8);
+
+ assert_equals(input_drag.value, '1');
+ assert_equals(input_drop.value, '42345678');
+
+ testRunner.execCommand('undo');
+
+ assert_equals(input_drag.value, '12345678');
+ assert_equals(input_drop.value, '4');
+}, 'Undo drag&drop should update input.value');
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698