3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
13 var textEditor = InspectorTest.createTestEditor();
14 textEditor.overrideViewportForTest(0, undefined, 3);
15 textEditor.mimeType = "text/javascript";
16 textEditor.setReadOnly(false);
17 textEditor.element.focus();
19 textEditor.setText(foo.toString());
21 InspectorTest.addResult(textEditor.text());
23 function dumpTextEditorWithSelection()
25 InspectorTest.addResult(InspectorTest.textWithSelection(textEditor.text(), textEditor.selection()));
28 function homeButton(shift)
30 var key = WebInspector.isMac() ? "leftArrow" : "home";
31 var modifiers = WebInspector.isMac() ? ["metaKey"] : [];
33 modifiers.push("shiftKey");
34 eventSender.keyDown(key, modifiers);
37 InspectorTest.runTestSuite([
38 function testFirstNonBlankCharacter(next)
40 var selection = WebInspector.TextRange.createFromLocation(2, 8);
41 textEditor.setSelection(selection);
42 dumpTextEditorWithSelection();
44 dumpTextEditorWithSelection();
48 function testFirstNonBlankCharacterFromWhitespace(next)
50 var selection = WebInspector.TextRange.createFromLocation(2, 2);
51 textEditor.setSelection(selection);
52 dumpTextEditorWithSelection();
54 dumpTextEditorWithSelection();
58 function testHomeButtonToggling(next)
60 var selection = WebInspector.TextRange.createFromLocation(2, 2);
61 textEditor.setSelection(selection);
62 dumpTextEditorWithSelection();
64 dumpTextEditorWithSelection();
66 dumpTextEditorWithSelection();
68 dumpTextEditorWithSelection();
72 function testHomeButtonDoesNotChangeCursor(next)
74 var selection = WebInspector.TextRange.createFromLocation(0, 2);
75 textEditor.setSelection(selection);
76 dumpTextEditorWithSelection();
78 dumpTextEditorWithSelection();
80 dumpTextEditorWithSelection();
84 function testHomeButtonWithShift(next)
86 var selection = new WebInspector.TextRange(0, 0, 2, 8);
87 textEditor.setSelection(selection);
88 dumpTextEditorWithSelection();
90 dumpTextEditorWithSelection();
92 dumpTextEditorWithSelection();
94 dumpTextEditorWithSelection();
98 function testHomeButtonWithShiftInversed(next)
100 var selection = new WebInspector.TextRange(3, 1, 2, 8);
101 textEditor.setSelection(selection);
102 dumpTextEditorWithSelection();
104 dumpTextEditorWithSelection();
106 dumpTextEditorWithSelection();
108 dumpTextEditorWithSelection();
117 <body onload="runTest();">
119 This test verifies that home button triggers selection between first symbol of the line
120 and first non-blank symbol of the line.