blob: 58b17c93b3a1ca4c36956e82dacb0207489cf24d [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="highlighter-test.js"></script>
<script>
function test()
{
var src = "/*\n" +
" * a comment\n" +
" */";
var model = new WebInspector.TextEditorModel();
model.setText(src);
var selection;
function dumpTextModel(msg)
{
InspectorTest.addResult(msg);
InspectorTest.addResult(model.text());
InspectorTest.addResult('Selection ' + selection.startLine + ',' + selection.startColumn + ' ' + selection.endLine + ',' + selection.endColumn + '\n');
}
selection = model.indentLines(new WebInspector.TextRange(0, 0, 1, 0));
dumpTextModel("After indenting first fully selected line");
selection = model.indentLines(new WebInspector.TextRange(0, 5, 1, 0));
dumpTextModel("After indenting first partially selected line");
selection = model.unindentLines(new WebInspector.TextRange(0, 0, 2, 0));
dumpTextModel("After unindenting two fully selected lines");
selection = model.unindentLines(new WebInspector.TextRange(0, 5, 1, 6));
dumpTextModel("After unindenting two partially selected lines (bug 97462)");
selection = model.unindentLines(new WebInspector.TextRange(0, 0, 2, 3));
dumpTextModel("After unindenting three partially selected lines");
InspectorTest.completeTest();
}
</script>
</head>
<body onload="runTest()">
<p>
This test checks code indentation and unindentation of several lines of code.
</p>
</body>
</html>