Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / setrangetext-within-events.html
blob06af3801ce57e3f4a23689ef241e51a17d92886c
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 if (!window.eventSender) {
8 t.done();
9 return;
11 doSetSelectionRange('focus');
12 doSetSelectionRange('mousedown');
13 doSetSelectionRange('mouseup');
14 doSetSelectionRange('click');
15 t.done();
16 });
18 function doSetSelectionRange(eventType) {
19 var textfield = document.getElementById('textfield');
20 textfield.setSelectionRange(0, 1);
21 var tx = textfield.offsetLeft + 4;
22 var ty = textfield.offsetTop + 4;
24 textfield.addEventListener(eventType, setSelectionRange);
25 eventSender.mouseMoveTo(tx, ty);
26 eventSender.mouseDown();
27 eventSender.mouseUp();
28 if (eventType === 'mousedown') {
29 assert_equals(textfield.selectionStart, 0);
30 assert_equals(textfield.selectionEnd, 0);
31 } else {
32 assert_equals(textfield.selectionStart, 0);
33 assert_equals(textfield.selectionEnd, 5);
36 eventSender.leapForward(1000);
37 eventSender.mouseMoveTo(textfield.offsetLeft , textfield.offsetTop);
38 eventSender.mouseDown();
39 eventSender.mouseUp();
40 textfield.blur();
42 assert_equals(textfield.selectionStart, 0);
43 assert_equals(textfield.selectionEnd, 0);
44 textfield.removeEventListener(eventType, setSelectionRange);
47 function setSelectionRange(e) {
48 var textfield = document.getElementById('textfield');
49 textfield.setSelectionRange(0, textfield.value.length);
51 }, "This tests the selection of the text field after setSelectionRange is called.");
52 </script>
53 <input type="text" value="value" id="textfield"></input>