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 'package:polymer/src/build/common.dart'; | 7 import 'package:polymer/src/build/common.dart'; |
8 import 'package:polymer/src/build/import_inliner.dart'; | 8 import 'package:polymer/src/build/import_inliner.dart'; |
9 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 import 'common.dart'; |
11 | 12 |
12 import 'common.dart'; | 13 part 'code_extractor.dart'; |
13 | 14 |
14 final phases = [[new ImportInliner(new TransformOptions())]]; | 15 final phases = [[new ImportInliner(new TransformOptions())]]; |
15 | 16 |
16 void main() { | 17 void main() { |
17 useCompactVMConfiguration(); | 18 useCompactVMConfiguration(); |
18 group('rel=import', importTests); | 19 group('rel=import', importTests); |
19 group('rel=stylesheet', stylesheetTests); | 20 group('rel=stylesheet', stylesheetTests); |
| 21 group('script type=dart', codeExtractorTests); |
20 } | 22 } |
21 | 23 |
22 void importTests() { | 24 void importTests() { |
23 testPhases('no changes', phases, { | 25 testPhases('no changes', phases, { |
24 'a|web/test.html': '<!DOCTYPE html><html></html>', | 26 'a|web/test.html': '<!DOCTYPE html><html></html>', |
25 }, { | 27 }, { |
26 'a|web/test.html': '<!DOCTYPE html><html></html>', | 28 'a|web/test.html': '<!DOCTYPE html><html></html>', |
27 'a|web/test.html.scriptUrls': '[]', | 29 'a|web/test.html.scriptUrls': '[]', |
28 }); | 30 }); |
29 | 31 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 '</head><body><polymer-element>2</polymer-element></html>', | 104 '</head><body><polymer-element>2</polymer-element></html>', |
103 'a|web/second.js': '/*second*/' | 105 'a|web/second.js': '/*second*/' |
104 }, { | 106 }, { |
105 'a|web/test.html': | 107 'a|web/test.html': |
106 '<!DOCTYPE html><html><head>' | 108 '<!DOCTYPE html><html><head>' |
107 '</head><body>' | 109 '</head><body>' |
108 '<script type="text/javascript">/*first*/</script>' | 110 '<script type="text/javascript">/*first*/</script>' |
109 '<script src="second.js"></script>' | 111 '<script src="second.js"></script>' |
110 '<script>/*third*/</script>' | 112 '<script>/*third*/</script>' |
111 '<polymer-element>2</polymer-element>' | 113 '<polymer-element>2</polymer-element>' |
112 '<script type="application/dart">/*forth*/</script>' | 114 '<script type="application/dart" src="test.html.0.dart"></script>' |
113 '</body></html>', | 115 '</body></html>', |
114 'a|web/test.html.scriptUrls': '[]', | 116 'a|web/test.html.scriptUrls': '[]', |
| 117 'a|web/test.html.0.dart': 'library web_test_html_0;\n/*forth*/', |
115 'a|web/test2.html': | 118 'a|web/test2.html': |
116 '<!DOCTYPE html><html><head><script>/*third*/</script>' | 119 '<!DOCTYPE html><html><head><script>/*third*/</script>' |
117 '</head><body><polymer-element>2</polymer-element></html>', | 120 '</head><body><polymer-element>2</polymer-element></html>', |
118 'a|web/test2.html.scriptUrls': '[]', | 121 'a|web/test2.html.scriptUrls': '[]', |
119 'a|web/second.js': '/*second*/' | 122 'a|web/second.js': '/*second*/' |
120 }); | 123 }); |
121 | 124 |
122 testPhases('no transformation outside web/', phases, | 125 testPhases('no transformation outside web/', phases, |
123 { | 126 { |
124 'a|lib/test.html': | 127 'a|lib/test.html': |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 '<style>.first { color: black }</style>' | 662 '<style>.first { color: black }</style>' |
660 '<style>h1 { font-size: 70px; }</style>' | 663 '<style>h1 { font-size: 70px; }</style>' |
661 '<style>.second { color: black }</style>' | 664 '<style>.second { color: black }</style>' |
662 '</body></html>', | 665 '</body></html>', |
663 'a|web/test.html.scriptUrls': '[]', | 666 'a|web/test.html.scriptUrls': '[]', |
664 'a|web/test2.css': | 667 'a|web/test2.css': |
665 'h1 { font-size: 70px; }', | 668 'h1 { font-size: 70px; }', |
666 }); | 669 }); |
667 | 670 |
668 } | 671 } |
| 672 |
OLD | NEW |