| 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="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var prompt = WebInspector.ConsoleView.instance()._prompt; | 8 var prompt = Console.ConsoleView.instance()._prompt; |
| 9 InspectorTest.waitUntilConsoleEditorLoaded().then(step1); | 9 InspectorTest.waitUntilConsoleEditorLoaded().then(step1); |
| 10 | 10 |
| 11 function step1() | 11 function step1() |
| 12 { | 12 { |
| 13 sequential([ | 13 sequential([ |
| 14 () => pressEnterAfter("window"), | 14 () => pressEnterAfter("window"), |
| 15 () => pressEnterAfter("window."), | 15 () => pressEnterAfter("window."), |
| 16 () => pressEnterAfter("if (1 === 2)"), | 16 () => pressEnterAfter("if (1 === 2)"), |
| 17 () => pressEnterAfter("if (1 === 2) {"), | 17 () => pressEnterAfter("if (1 === 2) {"), |
| 18 () => pressEnterAfter("if (1 === 2) {}"), | 18 () => pressEnterAfter("if (1 === 2) {}"), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 var promise = Promise.resolve(); | 51 var promise = Promise.resolve(); |
| 52 for (var i = 0; i < tests.length; i++) | 52 for (var i = 0; i < tests.length; i++) |
| 53 promise = promise.then(tests[i]); | 53 promise = promise.then(tests[i]); |
| 54 return promise; | 54 return promise; |
| 55 } | 55 } |
| 56 | 56 |
| 57 function pressEnterAfter(text) | 57 function pressEnterAfter(text) |
| 58 { | 58 { |
| 59 var fulfill; | 59 var fulfill; |
| 60 var promise = new Promise(x => fulfill = x); | 60 var promise = new Promise(x => fulfill = x); |
| 61 InspectorTest.addSniffer(WebInspector.ConsolePrompt.prototype, "_enterPr
ocessedForTest", enterProcessed); | 61 InspectorTest.addSniffer(Console.ConsolePrompt.prototype, "_enterProcess
edForTest", enterProcessed); |
| 62 | 62 |
| 63 prompt.setText(text); | 63 prompt.setText(text); |
| 64 prompt.moveCaretToEndOfPrompt(); | 64 prompt.moveCaretToEndOfPrompt(); |
| 65 prompt._enterKeyPressed(InspectorTest.createKeyEvent("Enter")); | 65 prompt._enterKeyPressed(InspectorTest.createKeyEvent("Enter")); |
| 66 return promise; | 66 return promise; |
| 67 | 67 |
| 68 function enterProcessed() | 68 function enterProcessed() |
| 69 { | 69 { |
| 70 InspectorTest.addResult("Text Before Enter:"); | 70 InspectorTest.addResult("Text Before Enter:"); |
| 71 InspectorTest.addResult(text.replace(/ /g, ".")); | 71 InspectorTest.addResult(text.replace(/ /g, ".")); |
| 72 InspectorTest.addResult("Text After Enter:"); | 72 InspectorTest.addResult("Text After Enter:"); |
| 73 InspectorTest.addResult(prompt.text().replace(/ /g, ".") || "<empty>
"); | 73 InspectorTest.addResult(prompt.text().replace(/ /g, ".") || "<empty>
"); |
| 74 InspectorTest.addResult(""); | 74 InspectorTest.addResult(""); |
| 75 fulfill(); | 75 fulfill(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 </script> | 79 </script> |
| 80 </head> | 80 </head> |
| 81 <body onload="runTest()"> | 81 <body onload="runTest()"> |
| 82 <p>Tests that the console enters a newline instead of running a command if the c
ommand is incomplete.</p> | 82 <p>Tests that the console enters a newline instead of running a command if the c
ommand is incomplete.</p> |
| 83 </body> | 83 </body> |
| 84 </html> | 84 </html> |
| OLD | NEW |