f690639ee9b54101800334411769f80f58fc3445
[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         for (var i = 0; i < resultCount; ++i)
13             WebInspector.domAgent.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
14
15         function searchResultCallback(isLastItem, node)
16         {
17             node.getOuterHTML(addSearchResult.bind(this, isLastItem));
18         }
19
20         function addSearchResult(isLastItem, error, markupVa_lue)
21         {
22             InspectorTest.addResult(markupVa_lue.split("").join(" "));
23             if (isLastItem) {
24                 WebInspector.domAgent.cancelSearch();
25                 next();
26             }
27         }
28     }
29
30     InspectorTest.runTestSuite([
31         function testSetUp(next)
32         {
33             WebInspector.domAgent.requestDocument(next);
34         },
35
36         function testPlainText(next)
37         {
38             WebInspector.domAgent.performSearch("Foo" + "Bar", searchCallback.bind(this, next));
39         },
40
41         function testPartialText(next)
42         {
43             WebInspector.domAgent.performSearch("oo" + "Ba", searchCallback.bind(this, next));
44         },
45
46         function testStartTag(next)
47         {
48             WebInspector.domAgent.performSearch("<inpu" + "t", searchCallback.bind(this, next));
49         },
50
51         function testPartialTag(next)
52         {
53             WebInspector.domAgent.performSearch("npu" + "t", searchCallback.bind(this, next));
54         },
55
56         function testExactAttributeName(next)
57         {
58             WebInspector.domAgent.performSearch("valu" + "e", searchCallback.bind(this, next));
59         },
60
61         function testExactAttributeVal_ue(next)
62         {
63             WebInspector.domAgent.performSearch("In" + "putVa" + "l", searchCallback.bind(this, next));
64         },
65
66         function testPartialAttributeVal_ue(next)
67         {
68             WebInspector.domAgent.performSearch("n" + "putVa" + "l", searchCallback.bind(this, next));
69         },
70
71         function testXPathAttribute(next)
72         {
73             WebInspector.domAgent.performSearch("//html" + "//@attr", searchCallback.bind(this, next));
74         }
75     ]);
76
77 }
78 </script>
79 </head>
80
81 <body onload="runTest()">
82 <p>
83 Tests that elements panel search is returning proper results.
84 </p>
85
86 <div>FooBar</div>
87 <input value="InputVal">
88 <div attr="foo"></div>
89 <div id="terminator"></div>
90
91 </body>
92 </html>