Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / focus-selection-textarea.html
blob169826bcf7a56d9a5e11aa95b4f91280779036cf
1 <body onload="runTest()">
2 <script src="../../resources/js-test.js"></script>
4 <script>
5 function runTest()
7 if (!window.testRunner)
8 return;
10 var accessKeyModifiers = ["altKey"];
11 if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
12 accessKeyModifiers = ["ctrlKey", "altKey"];
14 testRunner.dumpEditingCallbacks();
15 testRunner.dumpAsText();
17 shouldBe("first.selectionStart", "11");
18 shouldBe("first.selectionEnd", "18");
19 eventSender.keyDown("\t");
20 shouldBe("first.selectionStart", "11");
21 shouldBe("first.selectionEnd", "18");
23 shouldBe("second.selectionStart", "11");
24 shouldBe("second.selectionEnd", "18");
25 eventSender.keyDown("J", accessKeyModifiers);
26 shouldBe("second.selectionStart", "11");
27 shouldBe("second.selectionEnd", "18");
29 shouldBe("third.selectionStart", "11");
30 shouldBe("third.selectionEnd", "18");
31 third.focus();
32 shouldBe("third.selectionStart", "11");
33 shouldBe("third.selectionEnd", "18");
35 shouldBe("fourth.selectionStart", "11");
36 shouldBe("fourth.selectionEnd", "18");
37 eventSender.mouseMoveTo(fourth.offsetLeft + 4, fourth.offsetTop + 4);
38 eventSender.mouseDown();
39 eventSender.mouseUp();
40 shouldBe("fourth.selectionStart", "0");
41 shouldBe("fourth.selectionEnd", "0");
43 shouldBe("fifth.selectionStart", "11");
44 shouldBe("fifth.selectionEnd", "18");
45 var fifthLabel = document.getElementById("fifthLabel");
46 eventSender.mouseMoveTo(fifthLabel.offsetLeft + 4, fifthLabel.offsetTop + 4);
47 eventSender.mouseDown();
48 eventSender.mouseUp();
49 shouldBe("fifth.selectionStart", "11");
50 shouldBe("fifth.selectionEnd", "18");
52 shouldBe("sixth.selectionStart", "11");
53 shouldBe("sixth.selectionEnd", "18");
54 eventSender.keyDown("U", accessKeyModifiers);
55 shouldBe("sixth.selectionStart", "11");
56 shouldBe("sixth.selectionEnd", "18");
58 shouldBe("seventh.selectionStart", "11");
59 shouldBe("seventh.selectionEnd", "18");
60 var seventLabel = document.getElementById("seventhLabel");
61 seventhLabel.focus();
62 shouldBe("seventh.selectionStart", "11");
63 shouldBe("seventh.selectionEnd", "18");
65 shouldBe("eighth.selectionStart", "11");
66 shouldBe("eighth.selectionEnd", "18");
67 var eighthLegend = document.getElementById("eighthLegend");
68 eighthLegend.focus();
69 shouldBe("eighth.selectionStart", "11");
70 shouldBe("eighth.selectionEnd", "18");
72 shouldBe("ninth.selectionStart", "11");
73 shouldBe("ninth.selectionEnd", "18");
74 eventSender.keyDown("I", accessKeyModifiers);
75 shouldBe("ninth.selectionStart", "11");
76 shouldBe("ninth.selectionEnd", "18");
79 </script>
81 <h2>&lt;textarea&gt; focus selection</h2>
83 <p>This test checks whether the selection is restored, cleared, or set
84 to the full range when using different ways to focus a text
85 area. These results all match Mozilla. When running manually, please
86 follow the steps below. In the test harness, the test runs
87 automatically.</p>
89 1) Hit tab, only the word "SUCCESS" should be selected:
90 <textarea id="first">FAILURE or SUCCESS</textarea>
91 <script>
92 var first = document.getElementById("first");
93 first.focus();
94 first.setSelectionRange(11, 18);
95 first.blur();
96 </script>
98 <br>
100 2) Hit Ctrl-Option-J (or Alt-J on Windows), only the word "SUCCESS" should be selected:
101 <textarea id="second" accesskey="j">FAILURE or SUCCESS</textarea>
102 <script>
103 var second = document.getElementById("second");
104 second.focus();
105 second.setSelectionRange(11, 18);
106 second.blur();
107 </script>
109 <br>
111 3) <input type="button" onclick="document.getElementById('third').focus()" value="Click this button">, only the word "SUCCESS" should be selected:
112 <textarea id="third">FAILURE or SUCCESS</textarea>
113 <script>
114 var third = document.getElementById("third");
115 third.focus();
116 third.setSelectionRange(11, 18);
117 third.blur();
118 </script>
120 <br>
122 4) Click in the input field, nothing should be selected:
123 <textarea id="fourth">FAILURE and FAILURE</textarea>
124 <script>
125 var fourth = document.getElementById("fourth");
126 fourth.focus();
127 fourth.setSelectionRange(11, 18);
128 fourth.blur();
129 </script>
131 <br>
133 5) <label id="fifthLabel" for="fifth" style="color: blue">Click this label, only the word "SUCCESS" should be selected:</label>
134 <textarea id="fifth">FAILURE or SUCCESS</textarea>
135 <script>
136 var second = document.getElementById("fifth");
137 fifth.focus();
138 fifth.setSelectionRange(11, 18);
139 fifth.blur();
140 </script>
142 <br>
144 6) <label id="sixthLabel" for="sixth" accesskey="u">Hit Ctrl-Option-U (or Alt-U on Windows), only the word "SUCCESS" should be selected:</label>
145 <textarea id="sixth">FAILURE or SUCCESS</textarea>
146 <script>
147 var sixth = document.getElementById("sixth");
148 sixth.focus();
149 sixth.setSelectionRange(11, 18);
150 sixth.blur();
151 </script>
153 <br>
155 7) <input type="button" onclick="document.getElementById('seventhLabel').focus()" value="Click this button"><label id="seventhLabel" for="seventh">, only the word "SUCCESS" should be selected:</label>
156 <textarea id="seventh">FAILURE or SUCCESS</textarea>
157 <script>
158 var seventh = document.getElementById("seventh");
159 seventh.focus();
160 seventh.setSelectionRange(11, 18);
161 seventh.blur();
162 </script>
164 <br>
166 8) <input type="button" onclick="document.getElementById('eighthLegend').focus()" value="Click this button">
167 <fieldset>
168 <legend id="eighthLegend">, only the word "SUCCESS" should be selected:</legend>
169 <textarea id="eighth">FAILURE or SUCCESS</textarea>
170 <script>
171 var eighth = document.getElementById("eighth");
172 eighth.focus();
173 eighth.setSelectionRange(11, 18);
174 eighth.blur();
175 </script>
176 </fieldset>
177 <br>
180 9) <fieldset>
181 <legend id="eighthLegend" accesskey="i">Hit Ctrl-Option-I (or Alt-I on Windows), only the word "SUCCESS" should be selected:</legend>
182 <textarea id="ninth">FAILURE or SUCCESS</textarea>
183 <script>
184 var ninth = document.getElementById("ninth");
185 ninth.focus();
186 ninth.setSelectionRange(11, 18);
187 ninth.blur();
188 </script>
189 </fieldset>
190 <br>
192 <p id="description"></p>
193 <div id="console"></div>
195 </body>