Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / elements-panel-search.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <script src="../../http/tests/inspector/inspector-test.js"></script>
5 <script>
6 function initializeShadowDOM()
7 {
8     var shadow = document.querySelector('#shadow-host').createShadowRoot();
9     var template = document.querySelector('#shadow-dom-template');
10
11     // Avoid matching this function
12     shadow.appendChild(template.content.cloneNode(true));
13 }
14
15 function test()
16 {
17
18     function searchCallback(next, resultCount)
19     {
20         if (resultCount == 0) {
21             InspectorTest.addResult("Nothing found");
22             WebInspector.domModel.cancelSearch();
23             next();
24         }
25
26         for (var i = 0; i < resultCount; ++i)
27             WebInspector.domModel.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
28
29         function searchResultCallback(isLastItem, node)
30         {
31             node.getOuterHTML(addSearchResult.bind(this, isLastItem));
32         }
33
34         function addSearchResult(isLastItem, error, markupVa_lue)
35         {
36             InspectorTest.addResult(markupVa_lue.split("").join(" "));
37             if (isLastItem) {
38                 WebInspector.domModel.cancelSearch();
39                 next();
40             }
41         }
42     }
43
44     function setUp(next)
45     {
46         WebInspector.domModel.requestDocument(step2);
47
48         function step2()
49         {
50             InspectorTest.evaluateInPage("initializeShadowDOM()", next);
51         }
52     }
53
54     InspectorTest.runTestSuite([
55         function testSetUp(next)
56         {
57             setUp(next);
58         },
59
60         function testPlainText(next)
61         {
62             WebInspector.domModel.performSearch("Fo" + "o" + "Bar", false, searchCallback.bind(this, next));
63         },
64
65         function testPartialText(next)
66         {
67             WebInspector.domModel.performSearch("oo" + "Ba", false, searchCallback.bind(this, next));
68         },
69
70         function testStartTag(next)
71         {
72             WebInspector.domModel.performSearch("<inpu" + "t", false, searchCallback.bind(this, next));
73         },
74
75         function testEndTag(next)
76         {
77             WebInspector.domModel.performSearch("npu" + "t>", false, searchCallback.bind(this, next));
78         },
79
80         function testPartialTag(next)
81         {
82             WebInspector.domModel.performSearch("npu" + "t", false, searchCallback.bind(this, next));
83         },
84
85         function testPartialAbsentTagStart(next)
86         {
87             WebInspector.domModel.performSearch("<npu" + "t", false, searchCallback.bind(this, next));
88         },
89
90         function testPartialAbsentTagEnd(next)
91         {
92             WebInspector.domModel.performSearch("npu" + ">", false, searchCallback.bind(this, next));
93         },
94
95         function testFullTag(next)
96         {
97             WebInspector.domModel.performSearch("<inpu" + "t>", false, searchCallback.bind(this, next));
98         },
99
100         function testExactAttributeName(next)
101         {
102             WebInspector.domModel.performSearch("valu" + "e", false, searchCallback.bind(this, next));
103         },
104
105         function testExactAttributeVal_ue(next)
106         {
107             WebInspector.domModel.performSearch("In" + "putVa" + "l", false, searchCallback.bind(this, next));
108         },
109
110         function testExactAttributeVal_ueWithQuotes(next)
111         {
112             WebInspector.domModel.performSearch("\"fo" + "o\"", false, searchCallback.bind(this, next));
113         },
114
115         function testPartialAttributeVal_ue(next)
116         {
117             WebInspector.domModel.performSearch("n" + "putVa" + "l", false, searchCallback.bind(this, next));
118         },
119
120         function testXPathAttribute(next)
121         {
122             WebInspector.domModel.performSearch("//html" + "//@attr", false, searchCallback.bind(this, next));
123         },
124
125         function testSelector(next)
126         {
127             WebInspector.domModel.performSearch("d" + "iv.divclass span", false, searchCallback.bind(this, next));
128         },
129
130         function testCaseUpperFindsLower(next)
131         {
132             WebInspector.domModel.performSearch("K" +"OO", false, searchCallback.bind(this, next));
133         },
134
135         function testCaseLowerFindsUpper(next)
136         {
137             WebInspector.domModel.performSearch("c" + "aseless", false, searchCallback.bind(this, next));
138         },
139
140         function testCaseAttribute(next)
141         {
142             WebInspector.domModel.performSearch("C" + "AMEL", false, searchCallback.bind(this, next));
143         },
144
145         function testSearchShadowDOM(next)
146         {
147             WebInspector.domModel.performSearch("<c" + "ontent", false, searchCallback.bind(this, next));
148         },
149
150         function testSearchUAShadowDOM(next)
151         {
152             InspectorTest.addResult("Searching UA shadow DOM with setting disabled:")
153             WebInspector.domModel.performSearch("inne" + "r-editor", false, searchCallback.bind(this, step2));
154
155             function step2()
156             {
157                 InspectorTest.addResult("Searching UA shadow DOM with setting enabled:")
158                 WebInspector.domModel.performSearch("inne" + "r-editor", true, searchCallback.bind(this, next));
159             }
160         },
161
162         function testSearchShadowHostChildren(next)
163         {
164             WebInspector.domModel.performSearch("shadow-host-c" + "ontent", false, searchCallback.bind(this, next));
165         },
166     ]);
167
168 }
169 </script>
170 </head>
171
172 <body onload="runTest()">
173 <p>
174 Tests that elements panel search is returning proper results.
175 </p>
176
177 <div>FooBar</div>
178 <input value="InputVal">
179 <div attr="foo"></div>
180 <div id="terminator"></div>
181 <div class="divclass"><span>Found by selector</span></div>
182 <span class="foo koo"></span>
183 <span class="CASELESS"></span>
184 <span data-camel="insenstive"></span>
185 <div id="shadow-host">
186     <div id="shadow-host-content"></div>
187 </div>
188 <template id="shadow-dom-template">
189   <div id="shadow-dom-outer">
190       <content></content>
191   </div>
192 </div>
193 </template>
194 <textarea></textarea>
195
196 </body>
197 </html>