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(name) { | 6 function codeSnippet(name) { |
7 return document.getElementById(name).textContent; | 7 return document.getElementById(name).textContent; |
8 } | 8 } |
9 | 9 |
10 function codeSnippetsNumber() { | 10 function codeSnippetsNumber() { |
11 return document.getElementsByClassName("test").length; | 11 return document.getElementsByClassName("test").length; |
12 } | 12 } |
13 | 13 |
14 function test() | 14 function test() |
15 { | 15 { |
16 var textEditor = InspectorTest.createTestEditor(); | 16 var textEditor = InspectorTest.createTestEditor(); |
17 textEditor.setMimeType("text/javascript"); | 17 textEditor.setMimeType("text/javascript"); |
18 textEditor.setReadOnly(false); | 18 textEditor.setReadOnly(false); |
19 textEditor.element.focus(); | 19 textEditor.element.focus(); |
20 Common.settingForTest("textEditorAutoDetectIndent").set(true); | 20 Common.settingForTest("textEditorAutoDetectIndent").set(true); |
21 function genericTest(snippetName, next) | 21 function genericTest(snippetName, next) |
22 { | 22 { |
23 var command = "codeSnippet('" + snippetName + "');"; | 23 var command = "codeSnippet('" + snippetName + "');"; |
24 InspectorTest.evaluateInPage(command, step2); | 24 InspectorTest.evaluateInPage(command, step2); |
25 function step2(result) | 25 function step2(result) |
26 { | 26 { |
27 textEditor.setText(result.value); | 27 textEditor.setText(result.value); |
28 var indent = textEditor.indent(); | 28 var indent = textEditor.indent(); |
29 var description = indent === Common.TextUtils.Indent.TabCharacter ?
"Tab" : indent.length + " spaces"; | 29 var description = indent === TextUtils.TextUtils.Indent.TabCharacter
? "Tab" : indent.length + " spaces"; |
30 InspectorTest.addResult("Autodetected indentation for " + snippetNam
e + ": " + | 30 InspectorTest.addResult("Autodetected indentation for " + snippetNam
e + ": " + |
31 description); | 31 description); |
32 next(); | 32 next(); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 function onTestNumberReceived(result) | 36 function onTestNumberReceived(result) |
37 { | 37 { |
38 var testSuite = []; | 38 var testSuite = []; |
39 InspectorTest.addResult("Tests number: " + result.value); | 39 InspectorTest.addResult("Tests number: " + result.value); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 b.push(44); | 151 b.push(44); |
152 b.push(44 * 2); | 152 b.push(44 * 2); |
153 return b.join("?"); | 153 return b.join("?"); |
154 } | 154 } |
155 }; | 155 }; |
156 })(); | 156 })(); |
157 } | 157 } |
158 </pre> | 158 </pre> |
159 </body> | 159 </body> |
160 </html> | 160 </html> |
OLD | NEW |