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));
18 function searchCallback(next, resultCount)
20 if (resultCount == 0) {
21 InspectorTest.addResult("Nothing found");
22 WebInspector.domModel.cancelSearch();
26 for (var i = 0; i < resultCount; ++i)
27 WebInspector.domModel.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
29 function searchResultCallback(isLastItem, node)
31 node.getOuterHTML(addSearchResult.bind(this, isLastItem));
34 function addSearchResult(isLastItem, error, markupVa_lue)
36 InspectorTest.addResult(markupVa_lue.split("").join(" "));
38 WebInspector.domModel.cancelSearch();
46 WebInspector.domModel.requestDocument(step2);
50 InspectorTest.evaluateInPage("initializeShadowDOM()", next);
54 InspectorTest.runTestSuite([
55 function testSetUp(next)
60 function testPlainText(next)
62 WebInspector.domModel.performSearch("Fo" + "o" + "Bar", false, searchCallback.bind(this, next));
65 function testPartialText(next)
67 WebInspector.domModel.performSearch("oo" + "Ba", false, searchCallback.bind(this, next));
70 function testStartTag(next)
72 WebInspector.domModel.performSearch("<inpu" + "t", false, searchCallback.bind(this, next));
75 function testEndTag(next)
77 WebInspector.domModel.performSearch("npu" + "t>", false, searchCallback.bind(this, next));
80 function testPartialTag(next)
82 WebInspector.domModel.performSearch("npu" + "t", false, searchCallback.bind(this, next));
85 function testPartialAbsentTagStart(next)
87 WebInspector.domModel.performSearch("<npu" + "t", false, searchCallback.bind(this, next));
90 function testPartialAbsentTagEnd(next)
92 WebInspector.domModel.performSearch("npu" + ">", false, searchCallback.bind(this, next));
95 function testFullTag(next)
97 WebInspector.domModel.performSearch("<inpu" + "t>", false, searchCallback.bind(this, next));
100 function testExactAttributeName(next)
102 WebInspector.domModel.performSearch("valu" + "e", false, searchCallback.bind(this, next));
105 function testExactAttributeVal_ue(next)
107 WebInspector.domModel.performSearch("In" + "putVa" + "l", false, searchCallback.bind(this, next));
110 function testExactAttributeVal_ueWithQuotes(next)
112 WebInspector.domModel.performSearch("\"fo" + "o\"", false, searchCallback.bind(this, next));
115 function testPartialAttributeVal_ue(next)
117 WebInspector.domModel.performSearch("n" + "putVa" + "l", false, searchCallback.bind(this, next));
120 function testXPathAttribute(next)
122 WebInspector.domModel.performSearch("//html" + "//@attr", false, searchCallback.bind(this, next));
125 function testSelector(next)
127 WebInspector.domModel.performSearch("d" + "iv.divclass span", false, searchCallback.bind(this, next));
130 function testCaseUpperFindsLower(next)
132 WebInspector.domModel.performSearch("K" +"OO", false, searchCallback.bind(this, next));
135 function testCaseLowerFindsUpper(next)
137 WebInspector.domModel.performSearch("c" + "aseless", false, searchCallback.bind(this, next));
140 function testCaseAttribute(next)
142 WebInspector.domModel.performSearch("C" + "AMEL", false, searchCallback.bind(this, next));
145 function testSearchShadowDOM(next)
147 WebInspector.domModel.performSearch("<c" + "ontent", false, searchCallback.bind(this, next));
150 function testSearchUAShadowDOM(next)
152 InspectorTest.addResult("Searching UA shadow DOM with setting disabled:")
153 WebInspector.domModel.performSearch("inne" + "r-editor", false, searchCallback.bind(this, step2));
157 InspectorTest.addResult("Searching UA shadow DOM with setting enabled:")
158 WebInspector.domModel.performSearch("inne" + "r-editor", true, searchCallback.bind(this, next));
162 function testSearchShadowHostChildren(next)
164 WebInspector.domModel.performSearch("shadow-host-c" + "ontent", false, searchCallback.bind(this, next));
172 <body onload="runTest()">
174 Tests that elements panel search is returning proper results.
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>
188 <template id="shadow-dom-template">
189 <div id="shadow-dom-outer">
194 <textarea></textarea>