Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / input-appearance-selection.html
blob431bccd526e9cd7707b02424160861b8c5b88a71
1 <html>
2 <head>
3 <script>
4 function test () {
5 var testField = document.getElementById('t1');
6 var results = document.getElementById('result');
8 testSelectionRange(1, 0, 0, 0, 0, testField, results);
9 testSelectionEnd(2, 17, 0, 17, testField, results);
10 testSelectionStart(3, 1, 1, 17, testField, results);
11 testSelectionRange(4, 10, 3, 3, 3, testField, results);
12 testSelectionEnd(5, 2, 2, 2, testField, results);
13 testSelectionRange(6, 5, 4, 4, 4, testField, results);
14 testSelectionRange(7, -5, -4, 0, 0, testField, results);
15 testSelectionRange(8, -5, 80, 0, 20, testField, results);
16 testSelectionRange(9, 3, 12, 3, 12, testField, results);
20 function testSelectionRange (testNumber, start, end, expectedStart, expectedEnd, tf, res)
22 tf.focus();
23 tf.setSelectionRange(start, end);
24 res.innerHTML = res.innerHTML + "<br>Test " + testNumber + ": setSelectionRange(" + start + ", " + end + ")";
25 if (tf.selectionStart == expectedStart && tf.selectionEnd == expectedEnd)
26 res.innerHTML = res.innerHTML + "<br>Passed.<br>";
27 else
28 res.innerHTML = res.innerHTML + "<br>Failed.<br>";
31 function testSelectionStart (testNumber, start, expectedStart, expectedEnd, tf, res)
33 tf.selectionStart = start;
34 res.innerHTML = res.innerHTML + "<br>Test " + testNumber + ": selectionStart = " + start;
35 if (tf.selectionStart == expectedStart && tf.selectionEnd == expectedEnd)
36 res.innerHTML = res.innerHTML + "<br>Passed.<br>";
37 else
38 res.innerHTML = res.innerHTML + "<br>Failed.<br>";
41 function testSelectionEnd (testNumber, end, expectedStart, expectedEnd, tf, res)
43 tf.selectionEnd = end;
44 res.innerHTML = res.innerHTML + "<br>Test " + testNumber + ": selectionEnd = " + end;
45 if (tf.selectionStart == expectedStart && tf.selectionEnd == expectedEnd)
46 res.innerHTML = res.innerHTML + "<br>Passed.<br>";
47 else
48 res.innerHTML = res.innerHTML + "<br>Failed.<br>";
51 </script>
52 </head>
53 <body onload="test()">
54 This tests the selection methods on the new text field.
55 <p>
56 <input type="text" id="t1" style="-khtml-appearance:textfield" value="123456789 ABCDEFGHIJ"></input>
57 <div id="result"></div>
58 </p>
59 </body>
60 </html>