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.all_phases_test; | 5 library polymer.test.build.all_phases_test; |
6 | 6 |
7 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory; | 7 import 'package:code_transformers/tests.dart' show testingDartSdkDirectory; |
8 import 'package:polymer/src/build/common.dart'; | 8 import 'package:polymer/src/build/common.dart'; |
9 import 'package:polymer/src/build/linter.dart' show USE_POLYMER_HTML, | 9 import 'package:polymer/src/build/linter.dart' show USE_POLYMER_HTML, |
10 USE_INIT_DART, ONLY_ONE_TAG; | 10 USE_INIT_DART, ONLY_ONE_TAG; |
11 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; | 11 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; |
12 import 'package:polymer/transformer.dart'; | 12 import 'package:polymer/transformer.dart'; |
13 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS; | 13 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS; |
14 import 'package:unittest/compact_vm_config.dart'; | 14 import 'package:unittest/compact_vm_config.dart'; |
15 | 15 |
16 import 'common.dart'; | 16 import 'common.dart'; |
17 | 17 |
18 void main() { | 18 void main() { |
19 useCompactVMConfiguration(); | 19 useCompactVMConfiguration(); |
20 var phases = createDeployPhases(new TransformOptions(), | 20 var phases = createDeployPhases(new TransformOptions(), |
21 sdkDir: testingDartSdkDirectory); | 21 sdkDir: testingDartSdkDirectory); |
22 | 22 |
23 testPhases('no changes', phases, { | 23 testPhases('no changes', phases, { |
24 'a|web/test.html': '<!DOCTYPE html><html></html>', | 24 'a|web/test.html': '<!DOCTYPE html><html></html>', |
25 }, {}, [ | 25 }, {}, [ |
26 'warning: $USE_POLYMER_HTML', | |
27 'warning: $USE_INIT_DART' | 26 'warning: $USE_INIT_DART' |
28 ]); | 27 ]); |
29 | 28 |
30 testPhases('observable changes', phases, { | 29 testPhases('observable changes', phases, { |
31 'a|web/test.dart': _sampleInput('A', 'foo'), | 30 'a|web/test.dart': _sampleInput('A', 'foo'), |
32 'a|web/test2.dart': _sampleOutput('B', 'bar'), | 31 'a|web/test2.dart': _sampleOutput('B', 'bar'), |
33 }, { | 32 }, { |
34 'a|web/test.dart': _sampleOutput('A', 'foo'), | 33 'a|web/test.dart': _sampleOutput('A', 'foo'), |
35 'a|web/test2.dart': _sampleOutput('B', 'bar'), | 34 'a|web/test2.dart': _sampleOutput('B', 'bar'), |
36 }); | 35 }); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 183 |
185 testPhases('with imports', phases, { | 184 testPhases('with imports', phases, { |
186 'a|web/index.html': | 185 'a|web/index.html': |
187 '<!DOCTYPE html><html><head>' | 186 '<!DOCTYPE html><html><head>' |
188 '<link rel="import" href="packages/polymer/polymer.html">' | 187 '<link rel="import" href="packages/polymer/polymer.html">' |
189 '<link rel="import" href="packages/a/test2.html">' | 188 '<link rel="import" href="packages/a/test2.html">' |
190 '</head><body>' | 189 '</head><body>' |
191 '<script type="application/dart" src="b.dart"></script>', | 190 '<script type="application/dart" src="b.dart"></script>', |
192 'a|web/b.dart': _sampleInput('B', 'bar'), | 191 'a|web/b.dart': _sampleInput('B', 'bar'), |
193 'a|lib/test2.html': | 192 'a|lib/test2.html': |
194 '<!DOCTYPE html><html><head></head><body>' | 193 '<!DOCTYPE html><html><head>' |
| 194 '<link rel="import" href="../../packages/polymer/polymer.html">' |
| 195 '</head><body>' |
195 '<polymer-element name="x-a">1' | 196 '<polymer-element name="x-a">1' |
196 '<script type="application/dart">' | 197 '<script type="application/dart">' |
197 '${_sampleInput("A", "foo")}</script>' | 198 '${_sampleInput("A", "foo")}</script>' |
198 '</polymer-element></html>', | 199 '</polymer-element></html>', |
199 }, { | 200 }, { |
200 'a|web/index.html': | 201 'a|web/index.html': |
201 '<!DOCTYPE html><html><head>' | 202 '<!DOCTYPE html><html><head>' |
202 '$WEB_COMPONENTS_TAG' | 203 '$WEB_COMPONENTS_TAG' |
203 '</head><body><polymer-element name="x-a">1</polymer-element>' | 204 '</head><body><polymer-element name="x-a">1</polymer-element>' |
204 '<script src="index.html_bootstrap.dart.js"></script>' | 205 '<script src="index.html_bootstrap.dart.js"></script>' |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 239 |
239 testPhases('experimental bootstrap', phases, { | 240 testPhases('experimental bootstrap', phases, { |
240 'a|web/index.html': | 241 'a|web/index.html': |
241 '<!DOCTYPE html><html><head>' | 242 '<!DOCTYPE html><html><head>' |
242 '<link rel="import" ' | 243 '<link rel="import" ' |
243 'href="packages/polymer/polymer_experimental.html">' | 244 'href="packages/polymer/polymer_experimental.html">' |
244 '<link rel="import" href="packages/a/test2.html">' | 245 '<link rel="import" href="packages/a/test2.html">' |
245 '<link rel="import" href="packages/a/load_b.html">', | 246 '<link rel="import" href="packages/a/load_b.html">', |
246 'a|lib/b.dart': _sampleInput('B', 'bar'), | 247 'a|lib/b.dart': _sampleInput('B', 'bar'), |
247 'a|lib/test2.html': | 248 'a|lib/test2.html': |
248 '<!DOCTYPE html><html><head></head><body>' | 249 '<!DOCTYPE html><html><head>' |
| 250 '<link rel="import" href="../../packages/polymer/polymer.html">' |
| 251 '</head><body>' |
249 '<polymer-element name="x-a">1' | 252 '<polymer-element name="x-a">1' |
250 '<script type="application/dart">' | 253 '<script type="application/dart">' |
251 '${_sampleInput("A", "foo")}</script>' | 254 '${_sampleInput("A", "foo")}</script>' |
252 '</polymer-element></html>', | 255 '</polymer-element></html>', |
253 'a|lib/load_b.html': | 256 'a|lib/load_b.html': |
254 '<!DOCTYPE html><html><head></head><body>' | 257 '<!DOCTYPE html><html><head></head><body>' |
255 '<script type="application/dart" src="b.dart"></script>', | 258 '<script type="application/dart" src="b.dart"></script>', |
256 }, { | 259 }, { |
257 'a|web/index.html': | 260 'a|web/index.html': |
258 '<!DOCTYPE html><html><head>' | 261 '<!DOCTYPE html><html><head>' |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 333 } |
331 | 334 |
332 @CustomTag('x-$className') | 335 @CustomTag('x-$className') |
333 class X${className} extends PolymerElement { | 336 class X${className} extends PolymerElement { |
334 X${className}.created() : super.created(); | 337 X${className}.created() : super.created(); |
335 } | 338 } |
336 @initMethod m_$fieldName() {} | 339 @initMethod m_$fieldName() {} |
337 main() {} | 340 main() {} |
338 '''; | 341 '''; |
339 } | 342 } |
OLD | NEW |