OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library polymer.test.build.import_inliner_test; | 5 library polymer.test.build.import_inliner_test; |
6 | 6 |
7 import 'dart:convert' show JSON; | 7 import 'dart:convert' show JSON; |
8 import 'package:polymer/src/build/common.dart'; | 8 import 'package:polymer/src/build/common.dart'; |
9 import 'package:polymer/src/build/import_inliner.dart'; | 9 import 'package:polymer/src/build/import_inliner.dart'; |
10 import 'package:unittest/compact_vm_config.dart'; | 10 import 'package:unittest/compact_vm_config.dart'; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import 'common.dart'; | 12 import 'common.dart'; |
13 | 13 |
14 part 'code_extractor.dart'; | 14 part 'code_extractor.dart'; |
15 | 15 |
16 final phases = [[new ImportInliner(new TransformOptions())]]; | 16 final phases = [[new ImportInliner(new TransformOptions())]]; |
17 | 17 |
18 void main() { | 18 void main() { |
19 useCompactVMConfiguration(); | 19 useCompactVMConfiguration(); |
20 group('rel=import', importTests); | 20 group('rel=import', importTests); |
21 group('rel=stylesheet', stylesheetTests); | 21 group('rel=stylesheet', stylesheetTests); |
22 group('script type=dart', codeExtractorTests); | 22 group('script type=dart', codeExtractorTests); |
23 } | 23 } |
24 | 24 |
25 void importTests() { | 25 void importTests() { |
26 testPhases('no changes', phases, { | 26 testPhases('no changes', phases, { |
27 'a|web/test.html': '<!DOCTYPE html><html></html>', | 27 'a|web/test.html': '<!DOCTYPE html><html></html>', |
28 }, { | 28 }, { |
29 'a|web/test.html': '<!DOCTYPE html><html></html>', | 29 'a|web/test.html': '<!DOCTYPE html><html></html>', |
30 'a|web/test.html.scriptUrls': '[]', | 30 'a|web/test.html._data': EMPTY_DATA, |
31 }); | 31 }); |
32 | 32 |
33 testPhases('empty import', phases, { | 33 testPhases('empty import', phases, { |
34 'a|web/test.html': | 34 'a|web/test.html': |
35 '<!DOCTYPE html><html><head>' | 35 '<!DOCTYPE html><html><head>' |
36 '<link rel="import" href="">' // empty href | 36 '<link rel="import" href="">' // empty href |
37 '</head></html>', | 37 '</head></html>', |
38 'a|web/test2.html': | 38 'a|web/test2.html': |
39 '<!DOCTYPE html><html><head>' | 39 '<!DOCTYPE html><html><head>' |
40 '<link rel="import">' // no href | 40 '<link rel="import">' // no href |
41 '</head></html>', | 41 '</head></html>', |
42 }, { | 42 }, { |
43 'a|web/test.html': | 43 'a|web/test.html': |
44 '<!DOCTYPE html><html><head>' | 44 '<!DOCTYPE html><html><head>' |
45 '</head><body></body></html>', | 45 '</head><body></body></html>', |
46 'a|web/test.html.scriptUrls': '[]', | 46 'a|web/test.html._data': EMPTY_DATA, |
47 'a|web/test2.html': | 47 'a|web/test2.html': |
48 '<!DOCTYPE html><html><head>' | 48 '<!DOCTYPE html><html><head>' |
49 '</head><body></body></html>', | 49 '</head><body></body></html>', |
50 'a|web/test2.html.scriptUrls': '[]', | 50 'a|web/test2.html._data': EMPTY_DATA, |
51 }); | 51 }); |
52 | 52 |
53 testPhases('shallow, no elements', phases, { | 53 testPhases('shallow, no elements', phases, { |
54 'a|web/test.html': | 54 'a|web/test.html': |
55 '<!DOCTYPE html><html><head>' | 55 '<!DOCTYPE html><html><head>' |
56 '<link rel="import" href="test2.html">' | 56 '<link rel="import" href="test2.html">' |
57 '</head></html>', | 57 '</head></html>', |
58 'a|web/test2.html': | 58 'a|web/test2.html': |
59 '<!DOCTYPE html><html><head>' | 59 '<!DOCTYPE html><html><head>' |
60 '</head></html>', | 60 '</head></html>', |
61 }, { | 61 }, { |
62 'a|web/test.html': | 62 'a|web/test.html': |
63 '<!DOCTYPE html><html><head>' | 63 '<!DOCTYPE html><html><head>' |
64 '</head><body></body></html>', | 64 '</head><body></body></html>', |
65 'a|web/test.html.scriptUrls': '[]', | 65 'a|web/test.html._data': EMPTY_DATA, |
66 'a|web/test2.html': | 66 'a|web/test2.html': |
67 '<!DOCTYPE html><html><head>' | 67 '<!DOCTYPE html><html><head>' |
68 '</head></html>', | 68 '</head></html>', |
69 'a|web/test2.html.scriptUrls': '[]', | 69 'a|web/test2.html._data': EMPTY_DATA, |
70 }); | 70 }); |
71 | 71 |
72 testPhases('shallow, elements, one import', phases, | 72 testPhases('shallow, elements, one import', phases, |
73 { | 73 { |
74 'a|web/test.html': | 74 'a|web/test.html': |
75 '<!DOCTYPE html><html><head>' | 75 '<!DOCTYPE html><html><head>' |
76 '<link rel="import" href="test2.html">' | 76 '<link rel="import" href="test2.html">' |
77 '</head></html>', | 77 '</head></html>', |
78 'a|web/test2.html': | 78 'a|web/test2.html': |
79 '<!DOCTYPE html><html><head>' | 79 '<!DOCTYPE html><html><head>' |
80 '</head><body><polymer-element>2</polymer-element></html>', | 80 '</head><body><polymer-element>2</polymer-element></html>', |
81 }, { | 81 }, { |
82 'a|web/test.html': | 82 'a|web/test.html': |
83 '<!DOCTYPE html><html><head>' | 83 '<!DOCTYPE html><html><head>' |
84 '</head><body>' | 84 '</head><body>' |
85 '<polymer-element>2</polymer-element>' | 85 '<polymer-element>2</polymer-element>' |
86 '</body></html>', | 86 '</body></html>', |
87 'a|web/test.html.scriptUrls': '[]', | 87 'a|web/test.html._data': EMPTY_DATA, |
88 'a|web/test2.html': | 88 'a|web/test2.html': |
89 '<!DOCTYPE html><html><head>' | 89 '<!DOCTYPE html><html><head>' |
90 '</head><body><polymer-element>2</polymer-element></html>', | 90 '</head><body><polymer-element>2</polymer-element></html>', |
91 'a|web/test2.html.scriptUrls': '[]', | 91 'a|web/test2.html._data': EMPTY_DATA, |
92 }); | 92 }); |
93 | 93 |
94 testPhases('preserves order of scripts', phases, | 94 testPhases('preserves order of scripts', phases, |
95 { | 95 { |
96 'a|web/test.html': | 96 'a|web/test.html': |
97 '<!DOCTYPE html><html><head>' | 97 '<!DOCTYPE html><html><head>' |
98 '<script type="text/javascript">/*first*/</script>' | 98 '<script type="text/javascript">/*first*/</script>' |
99 '<script src="second.js"></script>' | 99 '<script src="second.js"></script>' |
100 '<link rel="import" href="test2.html">' | 100 '<link rel="import" href="test2.html">' |
101 '<script>/*forth*/</script>' | 101 '<script>/*forth*/</script>' |
102 '</head></html>', | 102 '</head></html>', |
103 'a|web/test2.html': | 103 'a|web/test2.html': |
104 '<!DOCTYPE html><html><head><script>/*third*/</script>' | 104 '<!DOCTYPE html><html><head><script>/*third*/</script>' |
105 '</head><body><polymer-element>2</polymer-element></html>', | 105 '</head><body><polymer-element>2</polymer-element></html>', |
106 'a|web/second.js': '/*second*/' | 106 'a|web/second.js': '/*second*/' |
107 }, { | 107 }, { |
108 'a|web/test.html': | 108 'a|web/test.html': |
109 '<!DOCTYPE html><html><head>' | 109 '<!DOCTYPE html><html><head>' |
110 '</head><body>' | 110 '</head><body>' |
111 '<script type="text/javascript">/*first*/</script>' | 111 '<script type="text/javascript">/*first*/</script>' |
112 '<script src="second.js"></script>' | 112 '<script src="second.js"></script>' |
113 '<script>/*third*/</script>' | 113 '<script>/*third*/</script>' |
114 '<polymer-element>2</polymer-element>' | 114 '<polymer-element>2</polymer-element>' |
115 '<script>/*forth*/</script>' | 115 '<script>/*forth*/</script>' |
116 '</body></html>', | 116 '</body></html>', |
117 'a|web/test.html.scriptUrls': '[]', | 117 'a|web/test.html._data': EMPTY_DATA, |
118 'a|web/test2.html': | 118 'a|web/test2.html': |
119 '<!DOCTYPE html><html><head><script>/*third*/</script>' | 119 '<!DOCTYPE html><html><head><script>/*third*/</script>' |
120 '</head><body><polymer-element>2</polymer-element></html>', | 120 '</head><body><polymer-element>2</polymer-element></html>', |
121 'a|web/test2.html.scriptUrls': '[]', | 121 'a|web/test2.html._data': EMPTY_DATA, |
122 'a|web/second.js': '/*second*/' | 122 'a|web/second.js': '/*second*/' |
123 }); | 123 }); |
124 | 124 |
125 testPhases('preserves order of scripts, including Dart scripts', phases, | 125 testPhases('preserves order of scripts, extract Dart scripts', phases, |
126 { | 126 { |
127 'a|web/test.html': | 127 'a|web/test.html': |
128 '<!DOCTYPE html><html><head>' | 128 '<!DOCTYPE html><html><head>' |
129 '<script type="text/javascript">/*first*/</script>' | 129 '<script type="text/javascript">/*first*/</script>' |
130 '<script src="second.js"></script>' | 130 '<script src="second.js"></script>' |
131 '<link rel="import" href="test2.html">' | 131 '<link rel="import" href="test2.html">' |
132 '<script type="application/dart">/*forth*/</script>' | 132 '<script type="application/dart">/*fifth*/</script>' |
133 '</head></html>', | 133 '</head></html>', |
134 'a|web/test2.html': | 134 'a|web/test2.html': |
135 '<!DOCTYPE html><html><head><script>/*third*/</script>' | 135 '<!DOCTYPE html><html><head><script>/*third*/</script>' |
| 136 '<script type="application/dart">/*forth*/</script>' |
136 '</head><body><polymer-element>2</polymer-element></html>', | 137 '</head><body><polymer-element>2</polymer-element></html>', |
137 'a|web/second.js': '/*second*/' | 138 'a|web/second.js': '/*second*/' |
138 }, { | 139 }, { |
139 'a|web/test.html': | |
140 '<!DOCTYPE html><html><head>' | |
141 '</head><body>' | |
142 '<script type="text/javascript">/*first*/</script>' | |
143 '<script src="second.js"></script>' | |
144 '<script>/*third*/</script>' | |
145 '<polymer-element>2</polymer-element>' | |
146 '<script type="application/dart" src="test.html.0.dart"></script>' | |
147 '</body></html>', | |
148 'a|web/test.html.scriptUrls': '[]', | |
149 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*forth*/', | |
150 'a|web/test2.html': | |
151 '<!DOCTYPE html><html><head><script>/*third*/</script>' | |
152 '</head><body><polymer-element>2</polymer-element></html>', | |
153 'a|web/test2.html.scriptUrls': '[]', | |
154 'a|web/second.js': '/*second*/' | |
155 }); | |
156 | |
157 testPhases('preserves order, extract component scripts', phases, | |
158 { | |
159 'a|web/test.html': | |
160 '<!DOCTYPE html><html><head>' | |
161 '<script type="text/javascript">/*first*/</script>' | |
162 '<script src="second.js"></script>' | |
163 '<link rel="import" href="test2.html">' | |
164 '<script type="application/dart;component=1">/*forth*/</script>' | |
165 '<script type="application/dart;component=1">/*fifth*/</script>' | |
166 '</head></html>', | |
167 'a|web/test2.html': | |
168 '<!DOCTYPE html><html><head><script>/*third*/</script>' | |
169 '</head><body><polymer-element>2</polymer-element></html>', | |
170 'a|web/second.js': '/*second*/' | |
171 }, { | |
172 'a|web/test.html': | 140 'a|web/test.html': |
173 '<!DOCTYPE html><html><head>' | 141 '<!DOCTYPE html><html><head>' |
174 '</head><body>' | 142 '</head><body>' |
175 '<script type="text/javascript">/*first*/</script>' | 143 '<script type="text/javascript">/*first*/</script>' |
176 '<script src="second.js"></script>' | 144 '<script src="second.js"></script>' |
177 '<script>/*third*/</script>' | 145 '<script>/*third*/</script>' |
178 '<polymer-element>2</polymer-element>' | 146 '<polymer-element>2</polymer-element>' |
179 '</body></html>', | 147 '</body></html>', |
180 'a|web/test.html.scriptUrls': | 148 'a|web/test.html._data': expectedData([ |
181 '[["a","web/test.html.0.dart"],["a","web/test.html.1.dart"]]', | 149 'web/test.html.1.dart','web/test.html.0.dart']), |
182 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*forth*/', | 150 'a|web/test.html.1.dart': 'library a.web.test2_html_1;\n/*forth*/', |
183 'a|web/test.html.1.dart': 'library a.web.test_html_1;\n/*fifth*/', | 151 'a|web/test.html.0.dart': 'library a.web.test_html_0;\n/*fifth*/', |
184 'a|web/test2.html': | 152 'a|web/test2.html': |
185 '<!DOCTYPE html><html><head><script>/*third*/</script>' | 153 '<!DOCTYPE html><html><head></head><body><script>/*third*/</script>' |
186 '</head><body><polymer-element>2</polymer-element></html>', | 154 '<polymer-element>2</polymer-element></body></html>', |
187 'a|web/test2.html.scriptUrls': '[]', | 155 'a|web/test2.html._data': expectedData(['web/test2.html.0.dart']), |
| 156 'a|web/test2.html.0.dart': 'library a.web.test2_html_0;\n/*forth*/', |
188 'a|web/second.js': '/*second*/' | 157 'a|web/second.js': '/*second*/' |
189 }); | 158 }); |
190 | 159 |
191 testPhases('no transformation outside web/', phases, | 160 testPhases('no transformation outside web/', phases, |
192 { | 161 { |
193 'a|lib/test.html': | 162 'a|lib/test.html': |
194 '<!DOCTYPE html><html><head>' | 163 '<!DOCTYPE html><html><head>' |
195 '<link rel="import" href="test2.html">' | 164 '<link rel="import" href="test2.html">' |
196 '</head></html>', | 165 '</head></html>', |
197 'a|lib/test2.html': | 166 'a|lib/test2.html': |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 '</head><body><polymer-element>2</polymer-element>' | 364 '</head><body><polymer-element>2</polymer-element>' |
396 '<script src="s2"></script></html>', | 365 '<script src="s2"></script></html>', |
397 }, { | 366 }, { |
398 'a|web/test.html': | 367 'a|web/test.html': |
399 '<!DOCTYPE html><html><head>' | 368 '<!DOCTYPE html><html><head>' |
400 '</head><body>' | 369 '</head><body>' |
401 '<polymer-element>2</polymer-element>' | 370 '<polymer-element>2</polymer-element>' |
402 '<script src="s2"></script>' | 371 '<script src="s2"></script>' |
403 '<polymer-element>1</polymer-element>' | 372 '<polymer-element>1</polymer-element>' |
404 '<script src="s1"></script></body></html>', | 373 '<script src="s1"></script></body></html>', |
405 'a|web/test.html.scriptUrls': '[]', | 374 'a|web/test.html._data': EMPTY_DATA, |
406 'a|web/test_1.html': | 375 'a|web/test_1.html': |
407 '<!DOCTYPE html><html><head>' | 376 '<!DOCTYPE html><html><head>' |
408 '</head><body>' | 377 '</head><body>' |
409 '<polymer-element>2</polymer-element>' | 378 '<polymer-element>2</polymer-element>' |
410 '<script src="s2"></script>' | 379 '<script src="s2"></script>' |
411 '<polymer-element>1</polymer-element>' | 380 '<polymer-element>1</polymer-element>' |
412 '<script src="s1"></script></body></html>', | 381 '<script src="s1"></script></body></html>', |
413 'a|web/test_1.html.scriptUrls': '[]', | 382 'a|web/test_1.html._data': EMPTY_DATA, |
414 'a|web/test_2.html': | 383 'a|web/test_2.html': |
415 '<!DOCTYPE html><html><head>' | 384 '<!DOCTYPE html><html><head>' |
416 '</head><body>' | 385 '</head><body>' |
417 '<polymer-element>1</polymer-element>' | 386 '<polymer-element>1</polymer-element>' |
418 '<script src="s1"></script>' | 387 '<script src="s1"></script>' |
419 '<polymer-element>2</polymer-element>' | 388 '<polymer-element>2</polymer-element>' |
420 '<script src="s2"></script></body></html>', | 389 '<script src="s2"></script></body></html>', |
421 'a|web/test_2.html.scriptUrls': '[]', | 390 'a|web/test_2.html._data': EMPTY_DATA, |
422 }); | 391 }); |
423 | 392 |
424 testPhases('imports cycle, 1-step lasso, Dart scripts too', phases, { | 393 testPhases('imports cycle, 1-step lasso, Dart scripts too', phases, { |
425 'a|web/test.html': | 394 'a|web/test.html': |
426 '<!DOCTYPE html><html><head>' | 395 '<!DOCTYPE html><html><head>' |
427 '<link rel="import" href="test_1.html">' | 396 '<link rel="import" href="test_1.html">' |
428 '</head></html>', | 397 '</head></html>', |
429 'a|web/test_1.html': | 398 'a|web/test_1.html': |
430 '<!DOCTYPE html><html><head>' | 399 '<!DOCTYPE html><html><head>' |
431 '<link rel="import" href="test_2.html">' | 400 '<link rel="import" href="test_2.html">' |
432 '</head><body><polymer-element>1</polymer-element>' | 401 '</head><body><polymer-element>1</polymer-element>' |
433 '<script type="application/dart" src="s1.dart"></script></html>', | 402 '<script type="application/dart" src="s1.dart">' |
434 'a|web/test_2.html': | |
435 '<!DOCTYPE html><html><head>' | |
436 '<link rel="import" href="test_1.html">' | |
437 '</head><body><polymer-element>2</polymer-element>' | |
438 '<script type="application/dart" src="s2.dart"></script></html>', | |
439 'a|web/s1.dart': '', | |
440 'a|web/s2.dart': '', | |
441 }, { | |
442 'a|web/test.html': | |
443 '<!DOCTYPE html><html><head>' | |
444 '</head><body>' | |
445 '<polymer-element>2</polymer-element>' | |
446 '<script type="application/dart" src="s2.dart"></script>' | |
447 '<polymer-element>1</polymer-element>' | |
448 '<script type="application/dart" src="s1.dart"></script>' | |
449 '</body></html>', | |
450 'a|web/test.html.scriptUrls': '[]', | |
451 'a|web/test_1.html': | |
452 '<!DOCTYPE html><html><head>' | |
453 '</head><body>' | |
454 '<polymer-element>2</polymer-element>' | |
455 '<script type="application/dart" src="s2.dart"></script>' | |
456 '<polymer-element>1</polymer-element>' | |
457 '<script type="application/dart" src="s1.dart"></script>' | |
458 '</body></html>', | |
459 'a|web/test_1.html.scriptUrls': '[]', | |
460 'a|web/test_2.html': | |
461 '<!DOCTYPE html><html><head>' | |
462 '</head><body>' | |
463 '<polymer-element>1</polymer-element>' | |
464 '<script type="application/dart" src="s1.dart"></script>' | |
465 '<polymer-element>2</polymer-element>' | |
466 '<script type="application/dart" src="s2.dart"></script>' | |
467 '</body></html>', | |
468 'a|web/test_2.html.scriptUrls': '[]', | |
469 }); | |
470 | |
471 testPhases('imports cycle, 1-step lasso, Dart components scripts', phases, { | |
472 'a|web/test.html': | |
473 '<!DOCTYPE html><html><head>' | |
474 '<link rel="import" href="test_1.html">' | |
475 '</head></html>', | |
476 'a|web/test_1.html': | |
477 '<!DOCTYPE html><html><head>' | |
478 '<link rel="import" href="test_2.html">' | |
479 '</head><body><polymer-element>1</polymer-element>' | |
480 '<script type="application/dart;component=1" src="s1.dart">' | |
481 '</script></html>', | 403 '</script></html>', |
482 'a|web/test_2.html': | 404 'a|web/test_2.html': |
483 '<!DOCTYPE html><html><head>' | 405 '<!DOCTYPE html><html><head>' |
484 '<link rel="import" href="test_1.html">' | 406 '<link rel="import" href="test_1.html">' |
485 '</head><body><polymer-element>2' | 407 '</head><body><polymer-element>2' |
486 '<script type="application/dart;component=1" src="s2.dart"></script>' | 408 '<script type="application/dart" src="s2.dart"></script>' |
487 '</polymer-element>' | 409 '</polymer-element>' |
488 '</html>', | 410 '</html>', |
489 'a|web/s1.dart': '', | 411 'a|web/s1.dart': '', |
490 'a|web/s2.dart': '', | 412 'a|web/s2.dart': '', |
491 }, { | 413 }, { |
492 'a|web/test.html': | 414 'a|web/test.html': |
493 '<!DOCTYPE html><html><head>' | 415 '<!DOCTYPE html><html><head>' |
494 '</head><body>' | 416 '</head><body>' |
495 '<polymer-element>2</polymer-element>' | 417 '<polymer-element>2</polymer-element>' |
496 '<polymer-element>1</polymer-element>' | 418 '<polymer-element>1</polymer-element>' |
497 '</body></html>', | 419 '</body></html>', |
498 'a|web/test.html.scriptUrls': '[["a","web/s2.dart"],["a","web/s1.dart"]]', | 420 'a|web/test.html._data': expectedData(['web/s2.dart', 'web/s1.dart']), |
499 'a|web/test_1.html': | 421 'a|web/test_1.html': |
500 '<!DOCTYPE html><html><head>' | 422 '<!DOCTYPE html><html><head>' |
501 '</head><body>' | 423 '</head><body>' |
502 '<polymer-element>2</polymer-element>' | 424 '<polymer-element>2</polymer-element>' |
503 '<polymer-element>1</polymer-element>' | 425 '<polymer-element>1</polymer-element>' |
504 '</body></html>', | 426 '</body></html>', |
505 'a|web/test_1.html.scriptUrls': | 427 'a|web/test_1.html._data': expectedData(['web/s2.dart', 'web/s1.dart']), |
506 '[["a","web/s2.dart"],["a","web/s1.dart"]]', | |
507 'a|web/test_2.html': | 428 'a|web/test_2.html': |
508 '<!DOCTYPE html><html><head>' | 429 '<!DOCTYPE html><html><head>' |
509 '</head><body>' | 430 '</head><body>' |
510 '<polymer-element>1</polymer-element>' | 431 '<polymer-element>1</polymer-element>' |
511 '<polymer-element>2</polymer-element>' | 432 '<polymer-element>2' |
| 433 '</polymer-element>' |
512 '</body></html>', | 434 '</body></html>', |
513 'a|web/test_2.html.scriptUrls': | 435 'a|web/test_2.html._data': expectedData(['web/s1.dart', 'web/s2.dart']), |
514 '[["a","web/s1.dart"],["a","web/s2.dart"]]', | |
515 }); | 436 }); |
516 | 437 |
517 testPhases('imports with Dart script after JS script', phases, { | 438 testPhases('imports with Dart script after JS script', phases, { |
518 'a|web/test.html': | 439 'a|web/test.html': |
519 '<!DOCTYPE html><html><head>' | 440 '<!DOCTYPE html><html><head>' |
520 '<link rel="import" href="test_1.html">' | 441 '<link rel="import" href="test_1.html">' |
521 '</head></html>', | 442 '</head></html>', |
522 'a|web/test_1.html': | 443 'a|web/test_1.html': |
523 '<!DOCTYPE html><html><head>' | 444 '<!DOCTYPE html><html><head>' |
524 '<link rel="import" href="test_1.html">' | 445 '<link rel="import" href="test_1.html">' |
525 '</head><body>' | 446 '</head><body>' |
526 '<foo>42</foo><bar-baz></bar-baz>' | 447 '<foo>42</foo><bar-baz></bar-baz>' |
527 '<polymer-element>1' | 448 '<polymer-element>1' |
528 '<script src="s1.js"></script>' | 449 '<script src="s1.js"></script>' |
529 '<script type="application/dart;component=1" src="s1.dart"></script>' | 450 '<script type="application/dart" src="s1.dart"></script>' |
530 '</polymer-element>' | 451 '</polymer-element>' |
531 'FOO</body></html>', | 452 'FOO</body></html>', |
532 'a|web/s1.dart': '', | 453 'a|web/s1.dart': '', |
533 }, { | 454 }, { |
534 'a|web/test.html': | 455 'a|web/test.html': |
535 '<!DOCTYPE html><html><head>' | 456 '<!DOCTYPE html><html><head>' |
536 '</head><body>' | 457 '</head><body>' |
537 '<foo>42</foo><bar-baz></bar-baz>' | 458 '<foo>42</foo><bar-baz></bar-baz>' |
538 '<polymer-element>1' | 459 '<polymer-element>1' |
539 '<script src="s1.js"></script>' | 460 '<script src="s1.js"></script>' |
540 '</polymer-element>' | 461 '</polymer-element>' |
541 'FOO</body></html>', | 462 'FOO</body></html>', |
542 'a|web/test.html.scriptUrls': '[["a","web/s1.dart"]]', | 463 'a|web/test.html._data': expectedData(['web/s1.dart']), |
543 'a|web/test_1.html': | 464 'a|web/test_1.html': |
544 '<!DOCTYPE html><html><head>' | 465 '<!DOCTYPE html><html><head>' |
545 '</head><body>' | 466 '</head><body>' |
546 '<foo>42</foo><bar-baz></bar-baz>' | 467 '<foo>42</foo><bar-baz></bar-baz>' |
547 '<polymer-element>1' | 468 '<polymer-element>1' |
548 '<script src="s1.js"></script>' | 469 '<script src="s1.js"></script>' |
549 '</polymer-element>' | 470 '</polymer-element>' |
550 'FOO</body></html>', | 471 'FOO</body></html>', |
551 'a|web/test_1.html.scriptUrls': '[["a","web/s1.dart"]]', | 472 'a|web/test_1.html._data': expectedData(['web/s1.dart']), |
552 }); | 473 }); |
553 | 474 |
554 testPhases('imports cycle, 2-step lasso', phases, { | 475 testPhases('imports cycle, 2-step lasso', phases, { |
555 'a|web/test.html': | 476 'a|web/test.html': |
556 '<!DOCTYPE html><html><head>' | 477 '<!DOCTYPE html><html><head>' |
557 '<link rel="import" href="test_1.html">' | 478 '<link rel="import" href="test_1.html">' |
558 '</head></html>', | 479 '</head></html>', |
559 'a|web/test_1.html': | 480 'a|web/test_1.html': |
560 '<!DOCTYPE html><html><head>' | 481 '<!DOCTYPE html><html><head>' |
561 '<link rel="import" href="test_2.html">' | 482 '<link rel="import" href="test_2.html">' |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 '</head></html>', | 586 '</head></html>', |
666 'a|web/test2.html': | 587 'a|web/test2.html': |
667 '<!DOCTYPE html><html><head>' | 588 '<!DOCTYPE html><html><head>' |
668 '<link rel="stylesheet">' // no href | 589 '<link rel="stylesheet">' // no href |
669 '</head></html>', | 590 '</head></html>', |
670 }, { | 591 }, { |
671 'a|web/test.html': | 592 'a|web/test.html': |
672 '<!DOCTYPE html><html><head>' | 593 '<!DOCTYPE html><html><head>' |
673 '<link rel="stylesheet" href="">' // empty href | 594 '<link rel="stylesheet" href="">' // empty href |
674 '</head></html>', | 595 '</head></html>', |
675 'a|web/test.html.scriptUrls': '[]', | 596 'a|web/test.html._data': EMPTY_DATA, |
676 'a|web/test2.html': | 597 'a|web/test2.html': |
677 '<!DOCTYPE html><html><head>' | 598 '<!DOCTYPE html><html><head>' |
678 '<link rel="stylesheet">' // no href | 599 '<link rel="stylesheet">' // no href |
679 '</head></html>', | 600 '</head></html>', |
680 'a|web/test2.html.scriptUrls': '[]', | 601 'a|web/test2.html._data': EMPTY_DATA, |
681 }); | 602 }); |
682 | 603 |
683 testPhases('absolute uri', phases, { | 604 testPhases('absolute uri', phases, { |
684 'a|web/test.html': | 605 'a|web/test.html': |
685 '<!DOCTYPE html><html><head>' | 606 '<!DOCTYPE html><html><head>' |
686 '<link rel="stylesheet" href="/foo.css">' | 607 '<link rel="stylesheet" href="/foo.css">' |
687 '</head></html>', | 608 '</head></html>', |
688 'a|web/test2.html': | 609 'a|web/test2.html': |
689 '<!DOCTYPE html><html><head>' | 610 '<!DOCTYPE html><html><head>' |
690 '<link rel="stylesheet" href="http://example.com/bar.css">' | 611 '<link rel="stylesheet" href="http://example.com/bar.css">' |
691 '</head></html>', | 612 '</head></html>', |
692 }, { | 613 }, { |
693 'a|web/test.html': | 614 'a|web/test.html': |
694 '<!DOCTYPE html><html><head>' | 615 '<!DOCTYPE html><html><head>' |
695 '<link rel="stylesheet" href="/foo.css">' | 616 '<link rel="stylesheet" href="/foo.css">' |
696 '</head></html>', | 617 '</head></html>', |
697 'a|web/test.html.scriptUrls': '[]', | 618 'a|web/test.html._data': EMPTY_DATA, |
698 'a|web/test2.html': | 619 'a|web/test2.html': |
699 '<!DOCTYPE html><html><head>' | 620 '<!DOCTYPE html><html><head>' |
700 '<link rel="stylesheet" href="http://example.com/bar.css">' | 621 '<link rel="stylesheet" href="http://example.com/bar.css">' |
701 '</head></html>', | 622 '</head></html>', |
702 'a|web/test2.html.scriptUrls': '[]', | 623 'a|web/test2.html._data': EMPTY_DATA, |
703 }); | 624 }); |
704 | 625 |
705 testPhases('shallow, inlines css', phases, { | 626 testPhases('shallow, inlines css', phases, { |
706 'a|web/test.html': | 627 'a|web/test.html': |
707 '<!DOCTYPE html><html><head>' | 628 '<!DOCTYPE html><html><head>' |
708 '<link rel="stylesheet" href="test2.css">' | 629 '<link rel="stylesheet" href="test2.css">' |
709 '</head></html>', | 630 '</head></html>', |
710 'a|web/test2.css': | 631 'a|web/test2.css': |
711 'h1 { font-size: 70px; }', | 632 'h1 { font-size: 70px; }', |
712 }, { | 633 }, { |
713 'a|web/test.html': | 634 'a|web/test.html': |
714 '<!DOCTYPE html><html><head></head><body>' | 635 '<!DOCTYPE html><html><head></head><body>' |
715 '<style>h1 { font-size: 70px; }</style>' | 636 '<style>h1 { font-size: 70px; }</style>' |
716 '</body></html>', | 637 '</body></html>', |
717 'a|web/test.html.scriptUrls': '[]', | 638 'a|web/test.html._data': EMPTY_DATA, |
718 'a|web/test2.css': | 639 'a|web/test2.css': |
719 'h1 { font-size: 70px; }', | 640 'h1 { font-size: 70px; }', |
720 }); | 641 }); |
721 | 642 |
722 testPhases('deep, inlines css', phases, { | 643 testPhases('deep, inlines css', phases, { |
723 'a|web/test.html': | 644 'a|web/test.html': |
724 '<!DOCTYPE html><html><head>' | 645 '<!DOCTYPE html><html><head>' |
725 '<link rel="import" href="test2.html">' | 646 '<link rel="import" href="test2.html">' |
726 '</head></html>', | 647 '</head></html>', |
727 'a|web/test2.html': | 648 'a|web/test2.html': |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 '</head></html>', | 728 '</head></html>', |
808 'a|web/test2.css': | 729 'a|web/test2.css': |
809 'h1 { font-size: 70px; }', | 730 'h1 { font-size: 70px; }', |
810 }, { | 731 }, { |
811 'a|web/test.html': | 732 'a|web/test.html': |
812 '<!DOCTYPE html><html><head></head><body>' | 733 '<!DOCTYPE html><html><head></head><body>' |
813 '<style>.first { color: black }</style>' | 734 '<style>.first { color: black }</style>' |
814 '<style>h1 { font-size: 70px; }</style>' | 735 '<style>h1 { font-size: 70px; }</style>' |
815 '<style>.second { color: black }</style>' | 736 '<style>.second { color: black }</style>' |
816 '</body></html>', | 737 '</body></html>', |
817 'a|web/test.html.scriptUrls': '[]', | 738 'a|web/test.html._data': EMPTY_DATA, |
818 'a|web/test2.css': | 739 'a|web/test2.css': |
819 'h1 { font-size: 70px; }', | 740 'h1 { font-size: 70px; }', |
820 }); | 741 }); |
821 } | 742 } |
OLD | NEW |