Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions.html

Issue 2769843003: DevTools: split text_utils out of common module (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 templateString() 6 function templateString()
7 { 7 {
8 console.log("The template string should not run and you should not see this log"); 8 console.log("The template string should not run and you should not see this log");
9 return { 9 return {
10 shouldNotFindThis:56 10 shouldNotFindThis:56
11 }; 11 };
12 } 12 }
13 13
14 function shouldNotFindThisFunction() { } 14 function shouldNotFindThisFunction() { }
15 function shouldFindThisFunction() { } 15 function shouldFindThisFunction() { }
16 window["should not find this"] = true; 16 window["should not find this"] = true;
17 17
18 var myMap = new Map([['first', 1], ['second', 2], ['third', 3], ['shouldNotFindT his', 4]]); 18 var myMap = new Map([['first', 1], ['second', 2], ['third', 3], ['shouldNotFindT his', 4]]);
19 19
20 function test() 20 function test()
21 { 21 {
22 var consoleEditor; 22 var consoleEditor;
23 function testCompletions(text, expected, force) 23 function testCompletions(text, expected, force)
24 { 24 {
25 var cursorPosition = text.indexOf('|'); 25 var cursorPosition = text.indexOf('|');
26 if (cursorPosition < 0) 26 if (cursorPosition < 0)
27 cursorPosition = Infinity; 27 cursorPosition = Infinity;
28 consoleEditor.setText(text.replace('|', '')); 28 consoleEditor.setText(text.replace('|', ''));
29 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position)); 29 consoleEditor.setSelection(TextUtils.TextRange.createFromLocation(0, cur sorPosition));
30 consoleEditor._autocompleteController.autocomplete(force); 30 consoleEditor._autocompleteController.autocomplete(force);
31 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected); 31 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected);
32 32
33 function checkExpected(suggestions) 33 function checkExpected(suggestions)
34 { 34 {
35 var completions = new Map(suggestions.map(suggestion => [suggestion. text, suggestion])); 35 var completions = new Map(suggestions.map(suggestion => [suggestion. text, suggestion]));
36 var message = "Checking '" + text.replace('\n', '\\n').replace('\r', '\\r') + "'"; 36 var message = "Checking '" + text.replace('\n', '\\n').replace('\r', '\\r') + "'";
37 if (force) 37 if (force)
38 message += " forcefully"; 38 message += " forcefully";
39 InspectorTest.addResult(message); 39 InspectorTest.addResult(message);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 () => testCompletions('var x = (do|);', ['document']) 101 () => testCompletions('var x = (do|);', ['document'])
102 ]).then(InspectorTest.completeTest); 102 ]).then(InspectorTest.completeTest);
103 103
104 } 104 }
105 </script> 105 </script>
106 </head> 106 </head>
107 <body onload="runTest()"> 107 <body onload="runTest()">
108 <p>Tests that console correctly finds suggestions in complicated cases.</p> 108 <p>Tests that console correctly finds suggestions in complicated cases.</p>
109 </body> 109 </body>
110 </html> 110 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698