OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="editor-test.js"></script> | 4 <script src="editor-test.js"></script> |
5 <script> | 5 <script> |
6 function codeSnippet() { | 6 function codeSnippet() { |
7 return document.getElementById("codeSnippet").textContent; | 7 return document.getElementById("codeSnippet").textContent; |
8 } | 8 } |
9 | 9 |
10 function test() | 10 function test() |
(...skipping 14 matching lines...) Expand all Loading... |
25 var textEditor = InspectorTest.createTestEditor(); | 25 var textEditor = InspectorTest.createTestEditor(); |
26 textEditor.setMimeType("text/javascript"); | 26 textEditor.setMimeType("text/javascript"); |
27 textEditor.setReadOnly(false); | 27 textEditor.setReadOnly(false); |
28 textEditor.element.focus(); | 28 textEditor.element.focus(); |
29 | 29 |
30 InspectorTest.runTestSuite([ | 30 InspectorTest.runTestSuite([ |
31 function testEnterInTheLineEnd(next) | 31 function testEnterInTheLineEnd(next) |
32 { | 32 { |
33 textEditor.setText(testFunction.toString()); | 33 textEditor.setText(testFunction.toString()); |
34 var line = textEditor.line(2); | 34 var line = textEditor.line(2); |
35 textEditor.setSelection(Common.TextRange.createFromLocation(2, line.
length)); | 35 textEditor.setSelection(TextUtils.TextRange.createFromLocation(2, li
ne.length)); |
36 hitEnterDumpTextAndNext(next); | 36 hitEnterDumpTextAndNext(next); |
37 }, | 37 }, |
38 | 38 |
39 function testEnterAfterOpenCurlyBrace(next) | 39 function testEnterAfterOpenCurlyBrace(next) |
40 { | 40 { |
41 textEditor.setText(testFunction.toString()); | 41 textEditor.setText(testFunction.toString()); |
42 var line = textEditor.line(1); | 42 var line = textEditor.line(1); |
43 textEditor.setSelection(Common.TextRange.createFromLocation(1, line.
length)); | 43 textEditor.setSelection(TextUtils.TextRange.createFromLocation(1, li
ne.length)); |
44 hitEnterDumpTextAndNext(next); | 44 hitEnterDumpTextAndNext(next); |
45 }, | 45 }, |
46 | 46 |
47 function testEnterInTheMiddleOfLine(next) | 47 function testEnterInTheMiddleOfLine(next) |
48 { | 48 { |
49 textEditor.setText(testFunction.toString()); | 49 textEditor.setText(testFunction.toString()); |
50 var line = textEditor.line(2); | 50 var line = textEditor.line(2); |
51 textEditor.setSelection(Common.TextRange.createFromLocation(2, line.
length / 2)); | 51 textEditor.setSelection(TextUtils.TextRange.createFromLocation(2, li
ne.length / 2)); |
52 hitEnterDumpTextAndNext(next); | 52 hitEnterDumpTextAndNext(next); |
53 }, | 53 }, |
54 | 54 |
55 function testEnterInTheBeginningOfTheLine(next) | 55 function testEnterInTheBeginningOfTheLine(next) |
56 { | 56 { |
57 textEditor.setText(testFunction.toString()); | 57 textEditor.setText(testFunction.toString()); |
58 textEditor.setSelection(Common.TextRange.createFromLocation(2, 0)); | 58 textEditor.setSelection(TextUtils.TextRange.createFromLocation(2, 0)
); |
59 hitEnterDumpTextAndNext(next); | 59 hitEnterDumpTextAndNext(next); |
60 }, | 60 }, |
61 | 61 |
62 function testEnterWithTheSelection(next) | 62 function testEnterWithTheSelection(next) |
63 { | 63 { |
64 textEditor.setText(testFunction.toString()); | 64 textEditor.setText(testFunction.toString()); |
65 textEditor.setSelection(new Common.TextRange(2, 2, 2, 4)); | 65 textEditor.setSelection(new TextUtils.TextRange(2, 2, 2, 4)); |
66 hitEnterDumpTextAndNext(next); | 66 hitEnterDumpTextAndNext(next); |
67 }, | 67 }, |
68 | 68 |
69 function testEnterWithReversedSelection(next) | 69 function testEnterWithReversedSelection(next) |
70 { | 70 { |
71 textEditor.setText(testFunction.toString()); | 71 textEditor.setText(testFunction.toString()); |
72 textEditor.setSelection(new Common.TextRange(2, 4, 2, 2)); | 72 textEditor.setSelection(new TextUtils.TextRange(2, 4, 2, 2)); |
73 hitEnterDumpTextAndNext(next); | 73 hitEnterDumpTextAndNext(next); |
74 }, | 74 }, |
75 | 75 |
76 function testEnterWithTheMultiLineSelection(next) | 76 function testEnterWithTheMultiLineSelection(next) |
77 { | 77 { |
78 textEditor.setText(testFunction.toString()); | 78 textEditor.setText(testFunction.toString()); |
79 textEditor.setSelection(new Common.TextRange(2, 0, 8, 4)); | 79 textEditor.setSelection(new TextUtils.TextRange(2, 0, 8, 4)); |
80 hitEnterDumpTextAndNext(next); | 80 hitEnterDumpTextAndNext(next); |
81 }, | 81 }, |
82 | 82 |
83 function testEnterWithFullLineSelection(next) | 83 function testEnterWithFullLineSelection(next) |
84 { | 84 { |
85 textEditor.setText(testFunction.toString()); | 85 textEditor.setText(testFunction.toString()); |
86 textEditor.setSelection(new Common.TextRange(2, 0, 3, 0)); | 86 textEditor.setSelection(new TextUtils.TextRange(2, 0, 3, 0)); |
87 hitEnterDumpTextAndNext(next); | 87 hitEnterDumpTextAndNext(next); |
88 }, | 88 }, |
89 | 89 |
90 function testEnterBeforeOpenBrace(next) | 90 function testEnterBeforeOpenBrace(next) |
91 { | 91 { |
92 textEditor.setText(testFunction.toString()); | 92 textEditor.setText(testFunction.toString()); |
93 textEditor.setSelection(new Common.TextRange(8, 0, 8, 0)); | 93 textEditor.setSelection(new TextUtils.TextRange(8, 0, 8, 0)); |
94 hitEnterDumpTextAndNext(next); | 94 hitEnterDumpTextAndNext(next); |
95 }, | 95 }, |
96 | 96 |
97 function testEnterMultiCursor(next) | 97 function testEnterMultiCursor(next) |
98 { | 98 { |
99 textEditor.setText(testFunction.toString()); | 99 textEditor.setText(testFunction.toString()); |
100 InspectorTest.setLineSelections(textEditor, [ | 100 InspectorTest.setLineSelections(textEditor, [ |
101 { line: 3, column: 0 }, | 101 { line: 3, column: 0 }, |
102 { line: 5, column: 1 }, | 102 { line: 5, column: 1 }, |
103 { line: 6, column: 2 }, | 103 { line: 6, column: 2 }, |
(...skipping 15 matching lines...) Expand all Loading... |
119 | 119 |
120 </script> | 120 </script> |
121 </head> | 121 </head> |
122 | 122 |
123 <body onload="runTest();"> | 123 <body onload="runTest();"> |
124 <p> | 124 <p> |
125 This test checks text editor enter behaviour. | 125 This test checks text editor enter behaviour. |
126 </p> | 126 </p> |
127 </body> | 127 </body> |
128 </html> | 128 </html> |
OLD | NEW |