Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / text-iterator / findString-selection-disabled.html
blob6e245b80fe8198a20428cd5910210717adf11925
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../resources/js-test.js"></script>
6 <style type="text/css">
7 .selectionDisabled { -webkit-user-select: none; }
8 .selectionEnabled { -webkit-user-select: auto; }
9 </style>
10 </head>
11 <body>
12 <div id="container"></div>
13 <pre id="console" style="visibility: hidden;"></pre>
14 <script>
15 function log(message)
17 document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
20 function testFindString(text, target, disableSelection, expected)
22 var selectionStatus = disableSelection ? "selection disabled:" : "selection enabled:";
23 log("Searching for '" + target + "' in '" + text + "' with " + selectionStatus);
25 var container = document.getElementById("container");
26 container.innerText = text;
27 document.body.offsetTop;
29 container.className = disableSelection ? "selectionDisabled" : "selectionEnabled";
31 shouldBe("testRunner.findString('" + target + "', [])", expected);
33 container.innerText = "";
34 log("");
37 if (!window.testRunner)
38 testFailed('This test requires the testRunner object');
39 else {
40 for (i = 0; i < 2; i++) {
41 var disableSelection = (i == 1);
43 testFindString("Some sample text that can be searched", "e", disableSelection, "true");
44 testFindString("Some sample text that can be searched", "o", disableSelection, "true");
45 testFindString("Some sample text that can be searched", "y", disableSelection, "false");
46 testFindString("Some sample text that can be searched", "t t", disableSelection, "true");
47 testFindString("insurmountable mountain", "mount", disableSelection, "true");
48 testFindString("insurmountable mountain", "Wally", disableSelection, "false");
52 document.getElementById("console").style.removeProperty("visibility");
54 var successfullyParsed = true;
55 </script>
56 </body>
57 </html>