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-', ['"foo-bar"]']), |
| 109 () => testCompletions('complicatedObject["foo-bar', ['"foo-bar"]']), |
| 110 () => testCompletions('complicatedObject["\'sing', ['"\'single-qouted\'"
]']), |
| 111 () => testCompletions('complicatedObject[\'\\\'sing', ['\'\\\'single-qou
ted\\\'\']']), |
| 112 () => testCompletions('complicatedObject["\'single-qou', ['"\'single-qou
ted\'"]']), |
| 113 () => testCompletions('complicatedObject["\\"double-qouted\\"', ['"\\"do
uble-qouted\\""]']), |
| 114 () => testCompletions('complicatedObject["notDangerous();', ['"notDanger
ous();"]']), |
102 ]).then(InspectorTest.completeTest); | 115 ]).then(InspectorTest.completeTest); |
103 | 116 |
104 } | 117 } |
105 </script> | 118 </script> |
106 </head> | 119 </head> |
107 <body onload="runTest()"> | 120 <body onload="runTest()"> |
108 <p>Tests that console correctly finds suggestions in complicated cases.</p> | 121 <p>Tests that console correctly finds suggestions in complicated cases.</p> |
109 </body> | 122 </body> |
110 </html> | 123 </html> |
OLD | NEW |