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 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 var complicatedObject = { |
20 'foo-bar': true, | |
21 '"double-qouted"': true, | |
22 "'single-qouted'": true, | |
23 "notDangerous();": true | |
24 } | |
20 function test() | 25 function test() |
21 { | 26 { |
22 var consoleEditor; | 27 var consoleEditor; |
23 function testCompletions(text, expected, force) | 28 function testCompletions(text, expected, force) |
24 { | 29 { |
25 var cursorPosition = text.indexOf('|'); | 30 var cursorPosition = text.indexOf('|'); |
26 if (cursorPosition < 0) | 31 if (cursorPosition < 0) |
27 cursorPosition = Infinity; | 32 cursorPosition = Infinity; |
28 consoleEditor.setText(text.replace('|', '')); | 33 consoleEditor.setText(text.replace('|', '')); |
29 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position)); | 34 consoleEditor.setSelection(Common.TextRange.createFromLocation(0, cursor Position)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 () => testCompletions("document.\tbo", ["body"]), | 96 () => testCompletions("document.\tbo", ["body"]), |
92 () => testCompletions("document.\nbo", ["body"]), | 97 () => testCompletions("document.\nbo", ["body"]), |
93 () => testCompletions("document.\r\nbo", ["body"]), | 98 () => testCompletions("document.\r\nbo", ["body"]), |
94 () => testCompletions("document [ 'bo", ["'body']"]), | 99 () => testCompletions("document [ 'bo", ["'body']"]), |
95 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]), | 100 () => testCompletions("function hey(should", ["shouldNotFindThisFunction "]), |
96 () => testCompletions("var should", ["shouldNotFindThisFunction"]), | 101 () => testCompletions("var should", ["shouldNotFindThisFunction"]), |
97 () => testCompletions("document[[win", ["window"]), | 102 () => testCompletions("document[[win", ["window"]), |
98 () => testCompletions("document[ [win", ["window"]), | 103 () => testCompletions("document[ [win", ["window"]), |
99 () => testCompletions("document[ [ win", ["window"]), | 104 () => testCompletions("document[ [ win", ["window"]), |
100 () => testCompletions('I|mag', ['Image', 'Infinity']), | 105 () => testCompletions('I|mag', ['Image', 'Infinity']), |
101 () => testCompletions('var x = (do|);', ['document']) | 106 () => testCompletions('var x = (do|);', ['document']), |
107 () => testCompletions('complicatedObject["foo', ['"foo-bar"]']), | |
108 () => testCompletions('complicatedObject["foo-bar', ['"foo-bar"]']), | |
dgozman
2017/03/17 20:58:50
Let's test example for the bug: "foo-".
einbinder
2017/03/20 17:50:47
Done.
| |
109 () => testCompletions('complicatedObject["\'sing', ['"\'single-qouted\'" ]']), | |
110 () => testCompletions('complicatedObject[\'\\\'sing', ['\'\\\'single-qou ted\\\'\']']), | |
111 () => testCompletions('complicatedObject["\'single-qou', ['"\'single-qou ted\'"]']), | |
112 () => testCompletions('complicatedObject["\\"double-qouted\\"', ['"\\"do uble-qouted\\""]']), | |
113 () => testCompletions('complicatedObject["notDangerous();', ['"notDanger ous();"]']), | |
102 ]).then(InspectorTest.completeTest); | 114 ]).then(InspectorTest.completeTest); |
103 | 115 |
104 } | 116 } |
105 </script> | 117 </script> |
106 </head> | 118 </head> |
107 <body onload="runTest()"> | 119 <body onload="runTest()"> |
108 <p>Tests that console correctly finds suggestions in complicated cases.</p> | 120 <p>Tests that console correctly finds suggestions in complicated cases.</p> |
109 </body> | 121 </body> |
110 </html> | 122 </html> |
OLD | NEW |