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

Unified Diff: LayoutTests/fast/forms/setrangetext-out-of-range.html

Issue 764313004: Fix the problem to keep the selection when clicking the substring out of range (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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: LayoutTests/fast/forms/setrangetext-out-of-range.html
diff --git a/LayoutTests/fast/forms/setrangetext-out-of-range.html b/LayoutTests/fast/forms/setrangetext-out-of-range.html
new file mode 100644
index 0000000000000000000000000000000000000000..48a28ff0c1b3ff7564d4f904646eae7f7f439222
--- /dev/null
+++ b/LayoutTests/fast/forms/setrangetext-out-of-range.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<script>
+ description("This tests the selection of the text field when mouse event occurs out of range");
+ jsTestIsAsync = true;
+ window.onload = function() {
+ runTest();
+ }
+ function runTest() {
+ var textfield = document.getElementById('textfield');
+ textfield.addEventListener('focus', setSelectionRange);
+ textfield.setSelectionRange(0, 1);
+
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ shouldBeZero('textfield.selectionStart');
+ shouldBe('textfield.selectionEnd', '5');
+
+ eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ debug('\nthe selection should be cleared');
+ shouldBeNonZero('textfield.selectionStart');
+ shouldBeNonZero('textfield.selectionEnd');
+ }
+ finishJSTest();
+ }
+
+ function setSelectionRange(e) {
+ var textfield = document.getElementById('textfield');
+ textfield.setSelectionRange(0, 5);
+ }
+</script>
+<input type="text" value="This text field is for the selection test" id="textfield"></input>
« no previous file with comments | « no previous file | LayoutTests/fast/forms/setrangetext-out-of-range-expected.txt » ('j') | Source/core/page/EventHandler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698