Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / textarea / textarea-setrangetext.html
blob67e9db0a2b321339177b091917694d59585521a2
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../../resources/js-test.js"></script>
6 <script src="../resources/common-setrangetext.js"></script>
7 </head>
8 <body>
9 <script>
10 description("Test setRangeText() method on textareas.");
12 runTestsShouldPass("textarea");
14 element = document.createElement("textarea");
15 document.body.appendChild(element);
16 debug("\nCheck that setRangeText() on textareas doesn't affect scroll position.");
17 var longString = "";
18 for (var i = 0; i < 20; i++)
19 longString += "0123456789\n";
20 evalAndLog("element.value = longString");
21 evalAndLog("element.scrollTop = 0");
22 evalAndLog("element.setSelectionRange(100, 110)");
23 evalAndLog("element.setRangeText('A', 9999, 9999, 'select')");
24 shouldBe("element.value", "longString+'A'");
25 shouldBe("element.selectionStart", "longString.length");
26 shouldBe("element.selectionEnd", "longString.length+1");
27 shouldBe("element.scrollTop", "0");
29 runTestsShouldPass("textarea", { dir: "rtl" });
30 </script>
31 </body>
32 </html>