2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></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
) {
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);
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.");
39 <input type=
"text" value=
"This text field is for the selection test" id=
"textfield"></input>