Web Inspector: searching for <u> in elements panel finds all tags containing "u"
[WebKit-https.git] / 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 test()
7 {
8     WebInspector.showPanel("elements");
9
10     function searchCallback(next, resultCount)
11     {
12         if (resultCount == 0) {
13             InspectorTest.addResult("Nothing found");
14             WebInspector.domAgent.cancelSearch();
15             next();
16         }
17
18         for (var i = 0; i < resultCount; ++i)
19             WebInspector.domAgent.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
20
21         function searchResultCallback(isLastItem, node)
22         {
23             node.getOuterHTML(addSearchResult.bind(this, isLastItem));
24         }
25
26         function addSearchResult(isLastItem, error, markupVa_lue)
27         {
28             InspectorTest.addResult(markupVa_lue.split("").join(" "));
29             if (isLastItem) {
30                 WebInspector.domAgent.cancelSearch();
31                 next();
32             }
33         }
34     }
35
36     InspectorTest.runTestSuite([
37         function testSetUp(next)
38         {
39             WebInspector.domAgent.requestDocument(next);
40         },
41
42         function testPlainText(next)
43         {
44             WebInspector.domAgent.performSearch("Fo" + "o" + "Bar", searchCallback.bind(this, next));
45         },
46
47         function testPartialText(next)
48         {
49             WebInspector.domAgent.performSearch("oo" + "Ba", searchCallback.bind(this, next));
50         },
51
52         function testStartTag(next)
53         {
54             WebInspector.domAgent.performSearch("<inpu" + "t", searchCallback.bind(this, next));
55         },
56
57         function testEndTag(next)
58         {
59             WebInspector.domAgent.performSearch("npu" + "t>", searchCallback.bind(this, next));
60         },
61
62         function testPartialTag(next)
63         {
64             WebInspector.domAgent.performSearch("npu" + "t", searchCallback.bind(this, next));
65         },
66
67         function testPartialAbsentTagStart(next)
68         {
69             WebInspector.domAgent.performSearch("<npu" + "t", searchCallback.bind(this, next));
70         },
71
72         function testPartialAbsentTagEnd(next)
73         {
74             WebInspector.domAgent.performSearch("npu" + ">", searchCallback.bind(this, next));
75         },
76
77         function testFullTag(next)
78         {
79             WebInspector.domAgent.performSearch("<inpu" + "t>", searchCallback.bind(this, next));
80         },
81
82         function testExactAttributeName(next)
83         {
84             WebInspector.domAgent.performSearch("valu" + "e", searchCallback.bind(this, next));
85         },
86
87         function testExactAttributeVal_ue(next)
88         {
89             WebInspector.domAgent.performSearch("In" + "putVa" + "l", searchCallback.bind(this, next));
90         },
91
92         function testExactAttributeVal_ueWithQuotes(next)
93         {
94             WebInspector.domAgent.performSearch("\"fo" + "o\"", searchCallback.bind(this, next));
95         },
96
97         function testPartialAttributeVal_ue(next)
98         {
99             WebInspector.domAgent.performSearch("n" + "putVa" + "l", searchCallback.bind(this, next));
100         },
101
102         function testXPathAttribute(next)
103         {
104             WebInspector.domAgent.performSearch("//html" + "//@attr", searchCallback.bind(this, next));
105         },
106
107         function testSelector(next)
108         {
109             WebInspector.domAgent.performSearch("d" + "iv.divclass span", searchCallback.bind(this, next));
110         }
111     ]);
112
113 }
114 </script>
115 </head>
116
117 <body onload="runTest()">
118 <p>
119 Tests that elements panel search is returning proper results.
120 </p>
121
122 <div>FooBar</div>
123 <input value="InputVal">
124 <div attr="foo"></div>
125 <div id="terminator"></div>
126 <div class="divclass"><span>Found by selector</span></div>
127 <span class="foo koo"></span>
128
129 </body>
130 </html>