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

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..97f99fb6ad2e4ae406fa0a6ff4f405defa96978a
--- /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");
+ window.onload = function() {
yosin_UTC9 2014/12/03 01:07:00 nit: Please add |jsTestIsAsync = true| and call |T
Miyoung Shin(g) 2014/12/03 03:39:10 Ok, I will update to use |jsTestIsAsync = true| an
+ runTest();
+ }
+ function runTest() {
+ var textfield = document.getElementById('textfield');
+ textfield.addEventListener('focus', setSelectionRange);
+ textfield.setSelectionRange(0, 1);
+ var tx = textfield.offsetLeft + textfield.offsetWidth - 4;
+ var ty = textfield.offsetTop + 4;
+
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(tx, ty);
yosin_UTC9 2014/12/03 01:06:59 nit: Please use four spaces indentation.
Miyoung Shin(g) 2014/12/03 03:39:10 OK. I will update
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ shouldBeZero('textfield.selectionStart');
+ shouldBe('textfield.selectionEnd', '5');
+
+ eventSender.mouseMoveTo(textfield.offsetLeft, ty + 30);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ debug('\nthe selection should be cleared');
+ shouldBeZero('textfield.selectionStart');
+ shouldBeZero('textfield.selectionEnd');
+ }
+ }
+
+ function setSelectionRange(e) {
+ var textfield = document.getElementById('textfield');
+ textfield.setSelectionRange(0, 5);
+ }
+</script>
+<input type="text" value="valueeeeeeeeeeeeeeeeeeeeeeeeeeee" id="textfield"></input>
yosin_UTC9 2014/12/03 01:07:00 nit: It is better to use different characters rath
Miyoung Shin(g) 2014/12/03 03:39:10 OK. I will update
« 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