Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / setrangetext-out-of-range.html
blob2bdf16eb01d8d625a14ff66b46b63252995682fd
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);
11 if (!window.eventSender) {
12 t.done();
13 return;
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);
22 eventSender.leapForward(1000);
23 eventSender.mouseMoveTo(textfield.offsetLeft + textfield.offsetWidth - 4, textfield.offsetTop + 4);
24 eventSender.mouseDown();
25 eventSender.mouseUp();
27 assert_not_equals(textfield.selectionStart, 0);
28 assert_not_equals(textfield.selectionEnd, 0);
30 t.done();
31 });
33 function setSelectionRange(e) {
34 var textfield = document.getElementById('textfield');
35 textfield.setSelectionRange(0, 5);
37 }, "This tests the selection of the text field when mouse event occurs out of range.");
38 </script>
39 <input type="text" value="This text field is for the selection test" id="textfield"></input>