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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 description("This tests the selection of the text field when mouse event occ urs out of range");
5 jsTestIsAsync = true;
6 window.onload = function() {
7 runTest();
8 }
9 function runTest() {
10 var textfield = document.getElementById('textfield');
11 textfield.addEventListener('focus', setSelectionRange);
12 textfield.setSelectionRange(0, 1);
13
14 if (window.eventSender) {
15 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
16 eventSender.mouseDown();
17 eventSender.mouseUp();
18 shouldBeZero('textfield.selectionStart');
19 shouldBe('textfield.selectionEnd', '5');
20
21 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
22 eventSender.mouseDown();
23 eventSender.mouseUp();
24 debug('\nthe selection should be cleared');
25 shouldBeNonZero('textfield.selectionStart');
26 shouldBeNonZero('textfield.selectionEnd');
27 }
28 finishJSTest();
29 }
30
31 function setSelectionRange(e) {
32 var textfield = document.getElementById('textfield');
33 textfield.setSelectionRange(0, 5);
34 }
35 </script>
36 <input type="text" value="This text field is for the selection test" id="textfie ld"></input>
OLDNEW
« 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