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

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

Issue 2656683003: Revert of DevTools: Console: Provide autocompletions for Maps (Closed)
Patch Set: Created 3 years, 11 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() { } 15
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]]);
19
20 function test() 18 function test()
21 { 19 {
22 var consoleEditor; 20 var consoleEditor;
23 function testCompletions(text, expected, force) 21 function testCompletions(text, expected, force)
24 { 22 {
25 var cursorPosition = text.indexOf('|'); 23 var cursorPosition = text.indexOf('|');
26 if (cursorPosition < 0) 24 if (cursorPosition < 0)
27 cursorPosition = Infinity; 25 cursorPosition = Infinity;
28 consoleEditor.setText(text.replace('|', '')); 26 consoleEditor.setText(text.replace('|', ''));
29 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position)); 27 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position));
30 consoleEditor._autocompleteController.autocomplete(force); 28 consoleEditor._autocompleteController.autocomplete(force);
31 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected); 29 return InspectorTest.addSnifferPromise(consoleEditor._autocompleteContro ller, "_onSuggestionsShownForTest").then(checkExpected);
32 30
33 function checkExpected(suggestions) 31 function checkExpected(suggestions)
34 { 32 {
35 var completions = new Set(suggestions.map(suggestion => suggestion.t itle)); 33 var completions = new Set(suggestions.map(suggestion => suggestion.t itle));
36 var message = "Checking '" + text.replace('\n', '\\n').replace('\r', '\\r') + "'"; 34 var message = "Checking '" + text + "'";
37 if (force) 35 if (force)
38 message += " forcefully"; 36 message += " forcefully";
39 InspectorTest.addResult(message); 37 InspectorTest.addResult(message);
40 for (var i = 0; i < expected.length; i++) 38 for (var i = 0; i < expected.length; i++)
41 InspectorTest.addResult((completions.has(expected[i]) ? "Found" : "Not Found") + ": " + expected[i]); 39 InspectorTest.addResult((completions.has(expected[i]) ? "Found" : "Not Found") + ": " + expected[i]);
42 InspectorTest.addResult(""); 40 InspectorTest.addResult("");
43 } 41 }
44 } 42 }
45 function sequential(tests) 43 function sequential(tests)
46 { 44 {
(...skipping 20 matching lines...) Expand all
67 () => testCompletions("32", ["Float32Array", "Int32Array"]), 65 () => testCompletions("32", ["Float32Array", "Int32Array"]),
68 () => testCompletions("window.32", ["Float32Array", "Int32Array"]), 66 () => testCompletions("window.32", ["Float32Array", "Int32Array"]),
69 () => testCompletions("", ["window"], false), 67 () => testCompletions("", ["window"], false),
70 () => testCompletions("", ["window"], true), 68 () => testCompletions("", ["window"], true),
71 () => testCompletions('"string g', ["getComputedStyle"], false), 69 () => testCompletions('"string g', ["getComputedStyle"], false),
72 () => testCompletions("`template string docu", ["document"], false), 70 () => testCompletions("`template string docu", ["document"], false),
73 () => testCompletions("`${do", ["document"], false), 71 () => testCompletions("`${do", ["document"], false),
74 () => testCompletions("// do", ["document"], false), 72 () => testCompletions("// do", ["document"], false),
75 () => testCompletions('["should', ["shouldNotFindThisFunction"]), 73 () => testCompletions('["should', ["shouldNotFindThisFunction"]),
76 () => testCompletions("shou", ["should not find this"]), 74 () => 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\')']),
82 () => testCompletions("document. bo", ["body"]), 75 () => testCompletions("document. bo", ["body"]),
83 () => testCompletions("document.\tbo", ["body"]), 76 () => testCompletions("document.\tbo", ["body"]),
84 () => testCompletions("document.\nbo", ["body"]), 77 () => testCompletions("document.\nbo", ["body"]),
85 () => testCompletions("document.\r\nbo", ["body"]), 78 () => testCompletions("document.\r\nbo", ["body"]),
86 () => testCompletions("document [ 'bo", ["'body']"]), 79 () => testCompletions("document [ 'bo", ["'body']"]),
87 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]), 80 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]),
88 () => testCompletions("var should", ["shouldNotFindThisFunction"]), 81 () => testCompletions("var should", ["shouldNotFindThisFunction"]),
89 () => testCompletions("document[[win", ["window"]), 82 () => testCompletions("document[[win", ["window"]),
90 () => testCompletions("document[ [win", ["window"]), 83 () => testCompletions("document[ [win", ["window"]),
91 () => testCompletions("document[ [ win", ["window"]), 84 () => testCompletions("document[ [ win", ["window"]),
92 () => testCompletions('I|mag', ['Image', 'Infinity']), 85 () => testCompletions('I|mag', ['Image', 'Infinity']),
93 () => testCompletions('var x = (do|);', ['document']) 86 () => testCompletions('var x = (do|);', ['document'])
94 ]).then(InspectorTest.completeTest); 87 ]).then(InspectorTest.completeTest);
95 88
96 } 89 }
97 </script> 90 </script>
98 </head> 91 </head>
99 <body onload="runTest()"> 92 <body onload="runTest()">
100 <p>Tests that console correctly finds suggestions in complicated cases.</p> 93 <p>Tests that console correctly finds suggestions in complicated cases.</p>
101 </body> 94 </body>
102 </html> 95 </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