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

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) {
yosin_UTC9 2015/07/13 03:47:22 nit: Could you use early return pattern?
Miyoung Shin(g) 2015/07/13 04:23:49 Done.
12 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
13 eventSender.mouseDown();
14 eventSender.mouseUp();
15 assert_equals(textfield.selectionStart, 0);
16 assert_equals(textfield.selectionEnd, 5);
17
18 eventSender.leapForward(1000);
19 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
20 eventSender.mouseDown();
21 eventSender.mouseUp();
22
23 assert_not_equals(textfield.selectionStart, 0);
24 assert_not_equals(textfield.selectionEnd, 0);
25 }
26 t.done();
27 });
28
29 function setSelectionRange(e) {
30 var textfield = document.getElementById('textfield');
31 textfield.setSelectionRange(0, 5);
32 }
33 }, "This tests the selection of the text field when mouse event occurs out of ra nge.");
34 </script>
35 <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