3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
6 function codeSnippet() {
7 return document.getElementById("codeSnippet").textContent;
12 var textEditor = InspectorTest.createTestEditor();
13 textEditor.setMimeType("text/javascript");
14 textEditor.setReadOnly(false);
15 textEditor.element.focus();
16 InspectorTest.evaluateInPage("codeSnippet();", onCodeSnippet);
19 function onCodeSnippet(result)
21 codeSnippetText = result.value;
22 InspectorTest.runTestSuite(testSuite);
25 function dumpAndNext(next)
27 function innerDumpAndNext()
29 InspectorTest.dumpTextWithSelection(textEditor, true);
32 return innerDumpAndNext;
36 function testSimpleCollapsedBlockExpanding(next)
38 textEditor.setText(codeSnippetText);
39 InspectorTest.setLineSelections(textEditor, [
42 InspectorTest.fakeKeyEvent(textEditor, "enter", [], dumpAndNext(next));
45 function testMulticursorCollapsedBlockExpanding(next)
47 textEditor.setText(codeSnippetText);
48 InspectorTest.setLineSelections(textEditor, [
53 InspectorTest.fakeKeyEvent(textEditor, "enter", [], dumpAndNext(next));
56 function testMulticursorCollapsedBlockNotExpanding(next)
58 textEditor.setText(codeSnippetText);
59 InspectorTest.setLineSelections(textEditor, [
63 InspectorTest.fakeKeyEvent(textEditor, "enter", [], dumpAndNext(next));
66 function testSingleCursorClosingBracketIndent(next)
68 textEditor.setText(codeSnippetText);
69 InspectorTest.setLineSelections(textEditor, [
72 InspectorTest.fakeKeyEvent(textEditor, "}", [], dumpAndNext(next));
75 function testMulticursorClosingBracketIndent(next)
77 textEditor.setText(codeSnippetText);
78 InspectorTest.setLineSelections(textEditor, [
82 InspectorTest.fakeKeyEvent(textEditor, "}", [], dumpAndNext(next));
85 function testMulticursorClosingBracketIndentNotExecuted(next)
87 textEditor.setText(codeSnippetText);
88 InspectorTest.setLineSelections(textEditor, [
92 InspectorTest.fakeKeyEvent(textEditor, "}", [], dumpAndNext(next));
100 <body onload="runTest();">
102 This test verifies applied indentation whenever you hit enter in "{|}" or type in "}" while inside opened block.
105 <pre id="codeSnippet">