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

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html

Issue 2882953002: Merge "INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur." to M59 (Closed)
Patch Set: 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
Index: third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html b/third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html
new file mode 100644
index 0000000000000000000000000000000000000000..9c2c084f11d5119bc9647569e82c793ee25e2fcb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<body>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<input>
+
+<script>
+var t = async_test('selectionStart/selectionEnd should be kept after input type changes.');
+t.step(() => {
+ assert_exists(window, 'eventSender');
+ var element = document.querySelector('input');
+ element.value = '';
+ element.focus();
+ eventSender.keyDown('c');
+ assert_equals(element.selectionStart, 1);
+ element.type = 'button';
+ assert_equals(element.selectionStart, null);
+ element.type = 'text';
+
+ // TODO(tkent): We need some delay before checking selectionStart because
+ // input type change doesn't update selectionStart immediately to avoid force
+ // layout. crbug.com/721217
+ t.step_timeout(() => {
+ assert_equals(element.selectionStart, 1);
+ t.done();
+ }, 1);
+});
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698