blob: 97f3407c940caee6dd4cf3004ff55aef715e85cf [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="editor-test.js"></script>
<script>
function test()
{
var cursorPosition = -1;
function runTestWithCursorPosition()
{
if (cursorPosition > textEditor.text().length)
return;
InspectorTest.addResult("=======================");
InspectorTest.addResult(InspectorTest.textWithSelection(textEditor.text(), textEditor.selection()));
InspectorTest.dumpEditorHTML(textEditor, true);
setTimeout(changeCursorPosition());
}
function changeCursorPosition()
{
++cursorPosition;
if (cursorPosition > textEditor.text().length) {
InspectorTest.completeTest();
return;
}
textEditor.setSelection(WebInspector.TextRange.createFromLocation(0, cursorPosition));
}
var textEditorDelegate = new WebInspector.TextEditorDelegate();
textEditorDelegate.selectionChanged = runTestWithCursorPosition;
var textEditor = InspectorTest.createTestEditor(undefined, undefined, textEditorDelegate);
textEditor.mimeType = "text/javascript";
textEditor.setReadOnly(false);
textEditor.setText("({()})(())");
textEditor.element.focus();
changeCursorPosition();
}
</script>
</head>
<body onload="runTest();">
<p>
This test checks how text editor highlights braces.
</p>
</body>
</html>