1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html id=
"documentElement">
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));
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 InspectorTest
.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
)
38 markupVa_lue
= markupVa_lue
.substr(0, markupVa_lue
.indexOf(">") + 1);
39 InspectorTest
.addResult(markupVa_lue
.split("").join(" "));
41 WebInspector
.DOMModel
.cancelSearch();
49 InspectorTest
.domModel
.requestDocument(step2
);
53 InspectorTest
.evaluateInPage("initializeShadowDOM()", next
);
57 InspectorTest
.runTestSuite([
58 function testSetUp(next
)
63 function testPlainText(next
)
65 InspectorTest
.domModel
.performSearch("Fo" + "o" + "Bar", false, searchCallback
.bind(this, next
));
68 function testPartialText(next
)
70 InspectorTest
.domModel
.performSearch("oo" + "Ba", false, searchCallback
.bind(this, next
));
73 function testStartTag(next
)
75 InspectorTest
.domModel
.performSearch("<inpu" + "t", false, searchCallback
.bind(this, next
));
78 function testEndTag(next
)
80 InspectorTest
.domModel
.performSearch("npu" + "t>", false, searchCallback
.bind(this, next
));
83 function testPartialTag(next
)
85 InspectorTest
.domModel
.performSearch("npu" + "t", false, searchCallback
.bind(this, next
));
88 function testPartialAbsentTagStart(next
)
90 InspectorTest
.domModel
.performSearch("<npu" + "t", false, searchCallback
.bind(this, next
));
93 function testPartialAbsentTagEnd(next
)
95 InspectorTest
.domModel
.performSearch("npu" + ">", false, searchCallback
.bind(this, next
));
98 function testFullTag(next
)
100 InspectorTest
.domModel
.performSearch("<inpu" + "t>", false, searchCallback
.bind(this, next
));
103 function testExactAttributeName(next
)
105 InspectorTest
.domModel
.performSearch("valu" + "e", false, searchCallback
.bind(this, next
));
108 function testExactAttributeVal_ue(next
)
110 InspectorTest
.domModel
.performSearch("In" + "putVa" + "l", false, searchCallback
.bind(this, next
));
113 function testExactAttributeVal_ueOnRoot(next
)
115 omitInnerHTML
= true;
116 InspectorTest
.domModel
.performSearch("documen" + "tElement", false, searchCallback
.bind(this, next
));
119 function testExactAttributeVal_ueWithQuotes(next
)
121 omitInnerHTML
= false;
122 InspectorTest
.domModel
.performSearch("\"fo" + "o\"", false, searchCallback
.bind(this, next
));
125 function testPartialAttributeVal_ue(next
)
127 InspectorTest
.domModel
.performSearch("n" + "putVa" + "l", false, searchCallback
.bind(this, next
));
130 function testXPathAttribute(next
)
132 InspectorTest
.domModel
.performSearch("//html" + "//@attr", false, searchCallback
.bind(this, next
));
135 function testSelector(next
)
137 InspectorTest
.domModel
.performSearch("d" + "iv.divclass span", false, searchCallback
.bind(this, next
));
140 function testCaseUpperFindsLower(next
)
142 InspectorTest
.domModel
.performSearch("K" +"OO", false, searchCallback
.bind(this, next
));
145 function testCaseLowerFindsUpper(next
)
147 InspectorTest
.domModel
.performSearch("c" + "aseless", false, searchCallback
.bind(this, next
));
150 function testCaseAttribute(next
)
152 InspectorTest
.domModel
.performSearch("C" + "AMEL", false, searchCallback
.bind(this, next
));
155 function testSearchShadowDOM(next
)
157 InspectorTest
.domModel
.performSearch("<c" + "ontent", false, searchCallback
.bind(this, next
));
160 function testSearchUAShadowDOM(next
)
162 InspectorTest
.addResult("Searching UA shadow DOM with setting disabled:")
163 InspectorTest
.domModel
.performSearch("inne" + "r-editor", false, searchCallback
.bind(this, step2
));
167 InspectorTest
.addResult("Searching UA shadow DOM with setting enabled:")
168 InspectorTest
.domModel
.performSearch("inne" + "r-editor", true, searchCallback
.bind(this, next
));
172 function testSearchShadowHostChildren(next
)
174 InspectorTest
.domModel
.performSearch("shadow-host-c" + "ontent", false, searchCallback
.bind(this, next
));
182 <body onload=
"runTest()">
184 Tests that elements panel search is returning proper results.
188 <input value=
"InputVal">
189 <div attr=
"foo"></div>
190 <div id=
"terminator"></div>
191 <div class=
"divclass"><span>Found by selector
</span></div>
192 <span class=
"foo koo"></span>
193 <span class=
"CASELESS"></span>
194 <span data-camel=
"insenstive"></span>
195 <div id=
"shadow-host">
196 <div id=
"shadow-host-content"></div>
198 <template id=
"shadow-dom-template">
199 <div id=
"shadow-dom-outer">
204 <textarea></textarea>