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

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

Issue 1049233003: Keep the selection of the text field when changed by JS. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 async_test(function(t) {
6 window.onload = t.step_func(function() {
7 var textfield = document.getElementById('textfield');
8 textfield.addEventListener('focus', setSelectionRange);
9 textfield.setSelectionRange(0, 1);
10
11 if (!window.eventSender) {
12 t.done();
13 return;
14 }
15
16 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4 , textfield.offsetTop + 4);
17 eventSender.mouseDown();
18 eventSender.mouseUp();
19 assert_equals(textfield.selectionStart, 0);
20 assert_equals(textfield.selectionEnd, 5);
21
22 eventSender.leapForward(1000);
23 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4 , textfield.offsetTop + 4);
24 eventSender.mouseDown();
25 eventSender.mouseUp();
26
27 assert_not_equals(textfield.selectionStart, 0);
28 assert_not_equals(textfield.selectionEnd, 0);
29
30 t.done();
31 });
32
33 function setSelectionRange(e) {
34 var textfield = document.getElementById('textfield');
35 textfield.setSelectionRange(0, 5);
36 }
37 }, "This tests the selection of the text field when mouse event occurs out of ra nge.");
38 </script>
39 <input type="text" value="This text field is for the selection test" id="textfie ld"></input>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698