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

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

Issue 2639703002: DevTools: Console: Provide autocompletions for Maps (Closed)
Patch Set: New RemoteObject api Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() { }
16 window["should not find this"] = true;
15 17
16 window["should not find this"] = true; 18 var myMap = new Map([['first', 1], ['second', 2], ['third', 3], ['shouldNotFindT his', 4]]);
17 19
18 function test() 20 function test()
19 { 21 {
20 var consoleEditor; 22 var consoleEditor;
21 function testCompletions(text, expected, force) 23 function testCompletions(text, expected, force)
22 { 24 {
23 var cursorPosition = text.indexOf('|'); 25 var cursorPosition = text.indexOf('|');
24 if (cursorPosition < 0) 26 if (cursorPosition < 0)
25 cursorPosition = Infinity; 27 cursorPosition = Infinity;
26 consoleEditor.setText(text.replace('|', '')); 28 consoleEditor.setText(text.replace('|', ''));
27 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position)); 29 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position));
28 consoleEditor._autocompleteController.autocomplete(force); 30 consoleEditor._autocompleteController.autocomplete(force);
29 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected); 31 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected);
30 32
31 function checkExpected(suggestions) 33 function checkExpected(suggestions)
32 { 34 {
33 var completions = new Set(suggestions.map(suggestion => suggestion.t itle)); 35 var completions = new Set(suggestions.map(suggestion => suggestion.t itle));
34 var message = "Checking '" + text + "'"; 36 var message = "Checking '" + text.replace('\n', '\\n').replace('\r', '\\r') + "'";
35 if (force) 37 if (force)
36 message += " forcefully"; 38 message += " forcefully";
37 InspectorTest.addResult(message); 39 InspectorTest.addResult(message);
38 for (var i = 0; i < expected.length; i++) 40 for (var i = 0; i < expected.length; i++)
39 InspectorTest.addResult((completions.has(expected[i]) ? "Found" : "Not Found") + ": " + expected[i]); 41 InspectorTest.addResult((completions.has(expected[i]) ? "Found" : "Not Found") + ": " + expected[i]);
40 InspectorTest.addResult(""); 42 InspectorTest.addResult("");
41 } 43 }
42 } 44 }
43 function sequential(tests) 45 function sequential(tests)
44 { 46 {
(...skipping 20 matching lines...) Expand all
65 () => testCompletions("32", ["Float32Array", "Int32Array"]), 67 () => testCompletions("32", ["Float32Array", "Int32Array"]),
66 () => testCompletions("window.32", ["Float32Array", "Int32Array"]), 68 () => testCompletions("window.32", ["Float32Array", "Int32Array"]),
67 () => testCompletions("", ["window"], false), 69 () => testCompletions("", ["window"], false),
68 () => testCompletions("", ["window"], true), 70 () => testCompletions("", ["window"], true),
69 () => testCompletions('"string g', ["getComputedStyle"], false), 71 () => testCompletions('"string g', ["getComputedStyle"], false),
70 () => testCompletions("`template string docu", ["document"], false), 72 () => testCompletions("`template string docu", ["document"], false),
71 () => testCompletions("`${do", ["document"], false), 73 () => testCompletions("`${do", ["document"], false),
72 () => testCompletions("// do", ["document"], false), 74 () => testCompletions("// do", ["document"], false),
73 () => testCompletions('["should', ["shouldNotFindThisFunction"]), 75 () => testCompletions('["should', ["shouldNotFindThisFunction"]),
74 () => testCompletions("shou", ["should not find this"]), 76 () => testCompletions("shou", ["should not find this"]),
77 () => testCompletions('myMap.get(', ['"first")', '"second")', '"third")' ]),
78 () => testCompletions('myMap.get(\'', ['\'first\')', '\'second\')', '\'t hird\')']),
79 () => testCompletions('myMap.set(\'firs', ['\'first\', ']),
80 () => testCompletions('myMap.set(should', ['shouldFindThisFunction', 'sh ouldNotFindThis', '\"shouldNotFindThis\")']),
81 () => testCompletions('myMap.delete(\'', ['\'first\')', '\'second\')', ' \'third\')']),
75 () => testCompletions("document. bo", ["body"]), 82 () => testCompletions("document. bo", ["body"]),
76 () => testCompletions("document.\tbo", ["body"]), 83 () => testCompletions("document.\tbo", ["body"]),
77 () => testCompletions("document.\nbo", ["body"]), 84 () => testCompletions("document.\nbo", ["body"]),
78 () => testCompletions("document.\r\nbo", ["body"]), 85 () => testCompletions("document.\r\nbo", ["body"]),
79 () => testCompletions("document [ 'bo", ["'body']"]), 86 () => testCompletions("document [ 'bo", ["'body']"]),
80 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]), 87 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]),
81 () => testCompletions("var should", ["shouldNotFindThisFunction"]), 88 () => testCompletions("var should", ["shouldNotFindThisFunction"]),
82 () => testCompletions("document[[win", ["window"]), 89 () => testCompletions("document[[win", ["window"]),
83 () => testCompletions("document[ [win", ["window"]), 90 () => testCompletions("document[ [win", ["window"]),
84 () => testCompletions("document[ [ win", ["window"]), 91 () => testCompletions("document[ [ win", ["window"]),
85 () => testCompletions('I|mag', ['Image', 'Infinity']), 92 () => testCompletions('I|mag', ['Image', 'Infinity']),
86 () => testCompletions('var x = (do|);', ['document']) 93 () => testCompletions('var x = (do|);', ['document'])
87 ]).then(InspectorTest.completeTest); 94 ]).then(InspectorTest.completeTest);
88 95
89 } 96 }
90 </script> 97 </script>
91 </head> 98 </head>
92 <body onload="runTest()"> 99 <body onload="runTest()">
93 <p>Tests that console correctly finds suggestions in complicated cases.</p> 100 <p>Tests that console correctly finds suggestions in complicated cases.</p>
94 </body> 101 </body>
95 </html> 102 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-correct-suggestions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698