blob: 959623912bcb9f57ba5dafc068ab7539719f3886 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="editor-test.js"></script>
<script>
function codeSnippet() {
return document.getElementById("codeSnippet").textContent;
}
function test()
{
var textEditor = InspectorTest.createTestEditor();
textEditor.setMimeType("text/javascript");
textEditor.setReadOnly(false);
textEditor.element.focus();
function step2(result)
{
var codeLines = result.value;
InspectorTest.typeIn(textEditor, codeLines, step3);
}
function step3()
{
InspectorTest.addResult("============ editor contents start ============");
InspectorTest.addResult(textEditor.text().replace(/ /g, "."));
InspectorTest.addResult("============ editor contents end ============");
InspectorTest.completeTest();
}
InspectorTest.evaluateInPage("codeSnippet();", step2);
}
</script>
</head>
<body onload="runTest();">
<p>
This test checks text editor javascript formatting.
</p>
<pre id="codeSnippet">/**
* Multi-line comment
*
*/
function foo(n) {
// one-line comment
function bar() {
return 42;D
var sum = 0;
for (var i = 0; i < n; ++i) {
for (var j = 0; j < n; ++j) {
sum += i + j;DD
if (sum > 1000) {
while (sum > 0) {
--sum;DDD
</pre>
</body>
</html>