Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / text / find-hidden-text.html
blobd8b66839f94d4b887b462cbfb4a0b6388dabd03b
1 <html>
2 <head>
3 <script>
4 function canFind(target, specimen)
6 getSelection().empty();
7 document.body.innerHTML = specimen;
8 document.execCommand("FindString", false, target);
9 var result = getSelection().rangeCount != 0;
10 getSelection().empty();
11 return result;
14 var messages = "";
16 function testTestStyle(isExpectedToFind, style, outerStyle)
18 var markup = "<div style='" + style + "'>word</div>";
19 var styleMessage = "styled with " + style;
21 if (outerStyle) {
22 markup = "<div style='" + outerStyle + "'>" + markup + "</div>";
23 styleMessage += " inside an element styled with " + outerStyle;
26 if (canFind("word", markup) == isExpectedToFind)
27 return;
29 if (isExpectedToFind)
30 messages += " Could not find";
31 else
32 messages += " Found";
33 messages += " a word " + styleMessage + ".";
36 function testNonHiddenTextStyle(style, outerStyle)
38 testTestStyle(true, style, outerStyle);
41 function testHiddenTextStyle(style, outerStyle)
43 testTestStyle(false, style, outerStyle);
46 function runTests()
48 if (window.testRunner)
49 testRunner.dumpAsText();
51 testNonHiddenTextStyle("");
53 testHiddenTextStyle("display:none");
54 testHiddenTextStyle("visibility:hidden");
56 testNonHiddenTextStyle("height:0");
58 testHiddenTextStyle("height:0; overflow:hidden");
59 testHiddenTextStyle("height:0; overflow:scroll");
60 testHiddenTextStyle("height:0; overflow:auto");
62 testHiddenTextStyle("width:0; overflow:hidden");
63 testHiddenTextStyle("width:0; overflow:scroll");
64 testHiddenTextStyle("width:0; overflow:auto");
66 testHiddenTextStyle("height:0; overflow-x:hidden");
67 testHiddenTextStyle("height:0; overflow-x:scroll");
68 testHiddenTextStyle("height:0; overflow-x:auto");
70 testHiddenTextStyle("width:0; overflow-x:hidden");
71 testHiddenTextStyle("width:0; overflow-x:scroll");
72 testHiddenTextStyle("width:0; overflow-x:auto");
74 testHiddenTextStyle("height:0; overflow-y:hidden");
75 testHiddenTextStyle("height:0; overflow-y:scroll");
76 testHiddenTextStyle("height:0; overflow-y:auto");
78 testHiddenTextStyle("width:0; overflow-y:hidden");
79 testHiddenTextStyle("width:0; overflow-y:scroll");
80 testHiddenTextStyle("width:0; overflow-y:auto");
82 testHiddenTextStyle("position: relative", "height:0; overflow:hidden");
83 testHiddenTextStyle("position: relative", "height:0; overflow:scroll");
84 testHiddenTextStyle("position: relative", "height:0; overflow:auto");
86 testNonHiddenTextStyle("position: absolute", "height:0; overflow:hidden");
87 testNonHiddenTextStyle("position: absolute", "height:0; overflow:scroll");
88 testNonHiddenTextStyle("position: absolute", "height:0; overflow:auto");
90 testNonHiddenTextStyle("position: fixed", "height:0; overflow:hidden");
91 testNonHiddenTextStyle("position: fixed", "height:0; overflow:scroll");
92 testNonHiddenTextStyle("position: fixed", "height:0; overflow:auto");
94 if (messages === "")
95 messages = "SUCCESS: Found all the strings we expected to, and none we did not expect to.";
96 else
97 messages = "FAILURE:" + messages;
99 document.body.innerHTML = messages;
101 </script>
102 </head>
103 <body onload="runTests()"></body>
104 </html>