| 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 test() | 6 function test() |
| 7 { | 7 { |
| 8 function testFunction(foo, bar) | 8 function testFunction(foo, bar) |
| 9 { | 9 { |
| 10 someFunctionCall(bar); | 10 someFunctionCall(bar); |
| 11 var b = 42; | 11 var b = 42; |
| 12 return a === 1 ? true : false; | 12 return a === 1 ? true : false; |
| 13 } | 13 } |
| 14 | 14 |
| 15 function testMyCamelMove(foo, bar) | 15 function testMyCamelMove(foo, bar) |
| 16 { | 16 { |
| 17 /* HelloWorld.TestSTRIng */ | 17 /* HelloWorld.TestSTRIng */ |
| 18 | 18 |
| 19 var a = e === 2; | 19 var a = e === 2; |
| 20 {} | 20 {} |
| 21 } | 21 } |
| 22 | 22 |
| 23 var textEditor = InspectorTest.createTestEditor(); | 23 var textEditor = InspectorTest.createTestEditor(); |
| 24 textEditor.setMimeType("text/javascript"); | 24 textEditor.setMimeType("text/javascript"); |
| 25 textEditor.setReadOnly(false); | 25 textEditor.setReadOnly(false); |
| 26 textEditor.setText(testFunction.toString()); | 26 textEditor.setText(testFunction.toString()); |
| 27 textEditor.element.focus(); | 27 textEditor.element.focus(); |
| 28 | 28 |
| 29 InspectorTest.addResult(textEditor.text()); | 29 InspectorTest.addResult(textEditor.text()); |
| 30 const wordJumpModifier = WebInspector.isMac() ? "altKey" : "ctrlKey"; | 30 const wordJumpModifier = Host.isMac() ? "altKey" : "ctrlKey"; |
| 31 const camelJumpModifier = WebInspector.isMac() ? "ctrlKey" : "altKey"; | 31 const camelJumpModifier = Host.isMac() ? "ctrlKey" : "altKey"; |
| 32 | 32 |
| 33 function dumpEditorSelection() | 33 function dumpEditorSelection() |
| 34 { | 34 { |
| 35 var selection = textEditor.selection(); | 35 var selection = textEditor.selection(); |
| 36 if (selection.isEmpty()) { | 36 if (selection.isEmpty()) { |
| 37 var line = textEditor.line(selection.startLine); | 37 var line = textEditor.line(selection.startLine); |
| 38 InspectorTest.addResult(line.substring(0, selection.startColumn) + "
|" + line.substring(selection.startColumn)); | 38 InspectorTest.addResult(line.substring(0, selection.startColumn) + "
|" + line.substring(selection.startColumn)); |
| 39 } else { | 39 } else { |
| 40 InspectorTest.addResult(">>" + textEditor.text(selection.normalize()
) + "<<"); | 40 InspectorTest.addResult(">>" + textEditor.text(selection.normalize()
) + "<<"); |
| 41 } | 41 } |
| 42 return selection; | 42 return selection; |
| 43 } | 43 } |
| 44 | 44 |
| 45 function setCursorAtBeginning() | 45 function setCursorAtBeginning() |
| 46 { | 46 { |
| 47 textEditor.setSelection(WebInspector.TextRange.createFromLocation(0, 0))
; | 47 textEditor.setSelection(Common.TextRange.createFromLocation(0, 0)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 function setCursorAtEnd() | 50 function setCursorAtEnd() |
| 51 { | 51 { |
| 52 var lastLine = textEditor.linesCount - 1; | 52 var lastLine = textEditor.linesCount - 1; |
| 53 var lastColumn = textEditor.line(lastLine).length; | 53 var lastColumn = textEditor.line(lastLine).length; |
| 54 textEditor.setSelection(WebInspector.TextRange.createFromLocation(lastLi
ne, lastColumn)); | 54 textEditor.setSelection(Common.TextRange.createFromLocation(lastLine, la
stColumn)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 function fireEventWhileSelectionChanges(eventType, modifiers, callback) | 57 function fireEventWhileSelectionChanges(eventType, modifiers, callback) |
| 58 { | 58 { |
| 59 var oldSelection = textEditor.selection(); | 59 var oldSelection = textEditor.selection(); |
| 60 | 60 |
| 61 function eventCallback() | 61 function eventCallback() |
| 62 { | 62 { |
| 63 var selection = dumpEditorSelection(); | 63 var selection = dumpEditorSelection(); |
| 64 if (selection.collapseToEnd().compareTo(oldSelection.collapseToEnd()
) !== 0) { | 64 if (selection.collapseToEnd().compareTo(oldSelection.collapseToEnd()
) !== 0) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 </script> | 153 </script> |
| 154 </head> | 154 </head> |
| 155 | 155 |
| 156 <body onload="runTest();"> | 156 <body onload="runTest();"> |
| 157 <p> | 157 <p> |
| 158 This test checks how text editor handles different movements: ctrl-left, ctrl-ri
ght, ctrl-shift-left, ctrl-backspace, alt-left, alt-right, alt-shift-left, alt-s
hift-right. | 158 This test checks how text editor handles different movements: ctrl-left, ctrl-ri
ght, ctrl-shift-left, ctrl-backspace, alt-left, alt-right, alt-shift-left, alt-s
hift-right. |
| 159 </p> | 159 </p> |
| 160 | 160 |
| 161 </body> | 161 </body> |
| 162 </html> | 162 </html> |
| OLD | NEW |