blob: b69c74583916a97dfa6b71d2f0dd901c5b6edf44 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>
function doit()
{
function callback(searchResults)
{
output("====================================");
output("Results:");
for (var i = 0; i < searchResults.length; ++i)
output(searchResults[i]);
notifyDone();
}
evaluateInWebInspector("frontend_performSearch", callback);
}
// Frontend functions.
function frontend_performSearch(testController)
{
testController.waitUntilDone();
var searchResults = [];
function addSearchResult(markupValue)
{
searchResults.push(markupValue);
}
WebInspector.addNodesToSearchResult = function(nodeIds)
{
for (var i = 0; i < nodeIds.length; ++i) {
var node = WebInspector.domAgent.nodeForId(nodeIds[i]);
if (node.nodeType === Node.TEXT_NODE)
searchResults.push(node.nodeValue);
else
InspectorBackend.getOuterHTML(node.id, addSearchResult);
}
}
// Plain text.
InspectorBackend.performSearch("Foo" + "Bar", true);
// Partial text.
InspectorBackend.performSearch("oo" + "Ba", true);
// Start tag.
InspectorBackend.performSearch("<inpu" + "t", true);
// Partial tag.
InspectorBackend.performSearch("npu" + "t", true);
// Exact attribute name.
InspectorBackend.performSearch("valu" + "e", true);
// Exact attribute val<>ue.
InspectorBackend.performSearch("In" + "putVa" + "l", true);
// Partial attribute val<>ue.
InspectorBackend.performSearch("n" + "putVa" + "l", true);
testController.runAfterPendingDispatches(function() {
testController.notifyDone(searchResults);
});
}
</script>
</head>
<body onload="onload()">
<p>
Tests that elements panel search is returning proper results.
</p>
<div>FooBar</div>
<input value="InputVal">
</body>
</html>