| 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() |
| 11 { | 11 { |
| 12 var textEditor = InspectorTest.createTestEditor(); | 12 var textEditor = InspectorTest.createTestEditor(); |
| 13 textEditor.setMimeType("text/javascript"); | 13 textEditor.setMimeType("text/javascript"); |
| 14 textEditor.setReadOnly(false); | 14 textEditor.setReadOnly(false); |
| 15 textEditor.element.focus(); | 15 textEditor.element.focus(); |
| 16 | 16 |
| 17 var completionDictionary = new WebInspector.SampleCompletionDictionary(); | 17 var completionDictionary = new WebInspector.SampleCompletionDictionary(); |
| 18 textEditor.setCompletionDictionary(completionDictionary); | 18 textEditor.setCompletionDictionary(completionDictionary); |
| 19 | 19 |
| 20 InspectorTest.runTestSuite([ | 20 InspectorTest.runTestSuite([ |
| 21 // This test has to be the first. It validates that autocompletion contr
oller |
| 22 // will initialize as a key will be pressed. |
| 23 function testCompletionsShowUpOnKeyPress(next) |
| 24 { |
| 25 textEditor.setText("name1 name2 name3 name4\nna"); |
| 26 textEditor.setSelection(WebInspector.TextRange.createFromLocation(1,
2)); |
| 27 InspectorTest.addSniffer(WebInspector.SuggestBox.prototype, "updateS
uggestions", onAutocompletionSuggestBox); |
| 28 InspectorTest.typeIn(textEditor, "m", new Function()); |
| 29 function onAutocompletionSuggestBox() |
| 30 { |
| 31 document.activeElement.dispatchEvent(InspectorTest.createKeyEven
t("Enter")); |
| 32 dumpDictionary(next); |
| 33 } |
| 34 }, |
| 35 |
| 21 function testSetInitialText(next) | 36 function testSetInitialText(next) |
| 22 { | 37 { |
| 23 textEditor.setText("one two three3_\nfour five\na_b\nsix\n123foo\n13
2\nseven"); | 38 textEditor.setText("one two three3_\nfour five\na_b\nsix\n123foo\n13
2\nseven"); |
| 24 dumpDictionary(next); | 39 dumpDictionary(next); |
| 25 }, | 40 }, |
| 26 | 41 |
| 27 function testAlphaNumericWords(next) | 42 function testAlphaNumericWords(next) |
| 28 { | 43 { |
| 29 textEditor.setText("2 2foo foo2 2foo4 foo3bar"); | 44 textEditor.setText("2 2foo foo2 2foo4 foo3bar"); |
| 30 dumpDictionary(next); | 45 dumpDictionary(next); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 </script> | 85 </script> |
| 71 </head> | 86 </head> |
| 72 | 87 |
| 73 <body onload="runTest();"> | 88 <body onload="runTest();"> |
| 74 <p> | 89 <p> |
| 75 This test checks how text editor updates autocompletion dictionary in a response | 90 This test checks how text editor updates autocompletion dictionary in a response |
| 76 to user input. | 91 to user input. |
| 77 </p> | 92 </p> |
| 78 </body> | 93 </body> |
| 79 </html> | 94 </html> |
| OLD | NEW |