blob: 1e8f795f50b0287107b1526a00ae0bc6d0e070ec [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 test()
{
WebInspector.showPanel("elements");
function searchCallback(next, resultCount)
{
if (resultCount == 0) {
InspectorTest.addResult("Nothing found");
WebInspector.domAgent.cancelSearch();
next();
}
for (var i = 0; i < resultCount; ++i)
WebInspector.domAgent.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
function searchResultCallback(isLastItem, node)
{
node.getOuterHTML(addSearchResult.bind(this, isLastItem));
}
function addSearchResult(isLastItem, error, markupVa_lue)
{
InspectorTest.addResult(markupVa_lue.split("").join(" "));
if (isLastItem) {
WebInspector.domAgent.cancelSearch();
next();
}
}
}
InspectorTest.runTestSuite([
function testSetUp(next)
{
WebInspector.domAgent.requestDocument(next);
},
function testPlainText(next)
{
WebInspector.domAgent.performSearch("Fo" + "o" + "Bar", searchCallback.bind(this, next));
},
function testPartialText(next)
{
WebInspector.domAgent.performSearch("oo" + "Ba", searchCallback.bind(this, next));
},
function testStartTag(next)
{
WebInspector.domAgent.performSearch("<inpu" + "t", searchCallback.bind(this, next));
},
function testEndTag(next)
{
WebInspector.domAgent.performSearch("npu" + "t>", searchCallback.bind(this, next));
},
function testPartialTag(next)
{
WebInspector.domAgent.performSearch("npu" + "t", searchCallback.bind(this, next));
},
function testPartialAbsentTagStart(next)
{
WebInspector.domAgent.performSearch("<npu" + "t", searchCallback.bind(this, next));
},
function testPartialAbsentTagEnd(next)
{
WebInspector.domAgent.performSearch("npu" + ">", searchCallback.bind(this, next));
},
function testFullTag(next)
{
WebInspector.domAgent.performSearch("<inpu" + "t>", searchCallback.bind(this, next));
},
function testExactAttributeName(next)
{
WebInspector.domAgent.performSearch("valu" + "e", searchCallback.bind(this, next));
},
function testExactAttributeVal_ue(next)
{
WebInspector.domAgent.performSearch("In" + "putVa" + "l", searchCallback.bind(this, next));
},
function testExactAttributeVal_ueWithQuotes(next)
{
WebInspector.domAgent.performSearch("\"fo" + "o\"", searchCallback.bind(this, next));
},
function testPartialAttributeVal_ue(next)
{
WebInspector.domAgent.performSearch("n" + "putVa" + "l", searchCallback.bind(this, next));
},
function testXPathAttribute(next)
{
WebInspector.domAgent.performSearch("//html" + "//@attr", searchCallback.bind(this, next));
},
function testSelector(next)
{
WebInspector.domAgent.performSearch("d" + "iv.divclass span", searchCallback.bind(this, next));
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests that elements panel search is returning proper results.
</p>
<div>FooBar</div>
<input value="InputVal">
<div attr="foo"></div>
<div id="terminator"></div>
<div class="divclass"><span>Found by selector</span></div>
<span class="foo koo"></span>
</body>
</html>