1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <script src="../../http/tests/inspector/inspector-test.js"></script>
6 function initializeShadowDOM()
8 var shadow = document.querySelector('#shadow-host').createShadowRoot();
9 var template = document.querySelector('#shadow-dom-template');
11 // Avoid matching this function
12 shadow.appendChild(template.content.cloneNode(true));
17 WebInspector.inspectorView.showPanel("elements");
19 function searchCallback(next, resultCount)
21 if (resultCount == 0) {
22 InspectorTest.addResult("Nothing found");
23 WebInspector.domModel.cancelSearch();
27 for (var i = 0; i < resultCount; ++i)
28 WebInspector.domModel.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
30 function searchResultCallback(isLastItem, node)
32 node.getOuterHTML(addSearchResult.bind(this, isLastItem));
35 function addSearchResult(isLastItem, error, markupVa_lue)
37 InspectorTest.addResult(markupVa_lue.split("").join(" "));
39 WebInspector.domModel.cancelSearch();
47 WebInspector.domModel.requestDocument(step2);
51 InspectorTest.evaluateInPage("initializeShadowDOM()", next);
55 InspectorTest.runTestSuite([
56 function testSetUp(next)
61 function testPlainText(next)
63 WebInspector.domModel.performSearch("Fo" + "o" + "Bar", false, searchCallback.bind(this, next));
66 function testPartialText(next)
68 WebInspector.domModel.performSearch("oo" + "Ba", false, searchCallback.bind(this, next));
71 function testStartTag(next)
73 WebInspector.domModel.performSearch("<inpu" + "t", false, searchCallback.bind(this, next));
76 function testEndTag(next)
78 WebInspector.domModel.performSearch("npu" + "t>", false, searchCallback.bind(this, next));
81 function testPartialTag(next)
83 WebInspector.domModel.performSearch("npu" + "t", false, searchCallback.bind(this, next));
86 function testPartialAbsentTagStart(next)
88 WebInspector.domModel.performSearch("<npu" + "t", false, searchCallback.bind(this, next));
91 function testPartialAbsentTagEnd(next)
93 WebInspector.domModel.performSearch("npu" + ">", false, searchCallback.bind(this, next));
96 function testFullTag(next)
98 WebInspector.domModel.performSearch("<inpu" + "t>", false, searchCallback.bind(this, next));
101 function testExactAttributeName(next)
103 WebInspector.domModel.performSearch("valu" + "e", false, searchCallback.bind(this, next));
106 function testExactAttributeVal_ue(next)
108 WebInspector.domModel.performSearch("In" + "putVa" + "l", false, searchCallback.bind(this, next));
111 function testExactAttributeVal_ueWithQuotes(next)
113 WebInspector.domModel.performSearch("\"fo" + "o\"", false, searchCallback.bind(this, next));
116 function testPartialAttributeVal_ue(next)
118 WebInspector.domModel.performSearch("n" + "putVa" + "l", false, searchCallback.bind(this, next));
121 function testXPathAttribute(next)
123 WebInspector.domModel.performSearch("//html" + "//@attr", false, searchCallback.bind(this, next));
126 function testSelector(next)
128 WebInspector.domModel.performSearch("d" + "iv.divclass span", false, searchCallback.bind(this, next));
131 function testCaseUpperFindsLower(next)
133 WebInspector.domModel.performSearch("K" +"OO", false, searchCallback.bind(this, next));
136 function testCaseLowerFindsUpper(next)
138 WebInspector.domModel.performSearch("c" + "aseless", false, searchCallback.bind(this, next));
141 function testCaseAttribute(next)
143 WebInspector.domModel.performSearch("C" + "AMEL", false, searchCallback.bind(this, next));
146 function testSearchShadowDOM(next)
148 WebInspector.domModel.performSearch("<c" + "ontent", false, searchCallback.bind(this, next));
151 function testSearchUAShadowDOM(next)
153 InspectorTest.addResult("Searching UA shadow DOM with setting disabled:")
154 WebInspector.domModel.performSearch("inne" + "r-editor", false, searchCallback.bind(this, step2));
158 InspectorTest.addResult("Searching UA shadow DOM with setting enabled:")
159 WebInspector.domModel.performSearch("inne" + "r-editor", true, searchCallback.bind(this, next));
163 function testSearchShadowHostChildren(next)
165 WebInspector.domModel.performSearch("shadow-host-c" + "ontent", false, searchCallback.bind(this, next));
173 <body onload="runTest()">
175 Tests that elements panel search is returning proper results.
179 <input value="InputVal">
180 <div attr="foo"></div>
181 <div id="terminator"></div>
182 <div class="divclass"><span>Found by selector</span></div>
183 <span class="foo koo"></span>
184 <span class="CASELESS"></span>
185 <span data-camel="insenstive"></span>
186 <div id="shadow-host">
187 <div id="shadow-host-content"></div>
189 <template id="shadow-dom-template">
190 <div id="shadow-dom-outer">
195 <textarea></textarea>