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