| 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/messages.dart'; |
| 10 USE_INIT_DART, ONLY_ONE_TAG; | |
| 11 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; | 10 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; |
| 12 import 'package:polymer/transformer.dart'; | 11 import 'package:polymer/transformer.dart'; |
| 13 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS; | 12 import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS; |
| 14 import 'package:unittest/compact_vm_config.dart'; | 13 import 'package:unittest/compact_vm_config.dart'; |
| 15 | 14 |
| 16 import 'common.dart'; | 15 import 'common.dart'; |
| 17 | 16 |
| 18 void main() { | 17 void main() { |
| 19 useCompactVMConfiguration(); | 18 useCompactVMConfiguration(); |
| 20 var phases = createDeployPhases(new TransformOptions(), | 19 var phases = createDeployPhases(new TransformOptions(), |
| 21 sdkDir: testingDartSdkDirectory); | 20 sdkDir: testingDartSdkDirectory); |
| 22 | 21 |
| 23 testPhases('no changes', phases, { | 22 testPhases('no changes', phases, { |
| 24 'a|web/test.html': '<!DOCTYPE html><html></html>', | 23 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| 25 }, {}, [ | 24 }, {}, [ |
| 26 'warning: $USE_INIT_DART' | 25 'warning: ${MISSING_INIT_POLYMER.snippet}' |
| 27 ]); | 26 ]); |
| 28 | 27 |
| 29 testPhases('observable changes', phases, { | 28 testPhases('observable changes', phases, { |
| 30 'a|web/test.dart': _sampleInput('A', 'foo'), | 29 'a|web/test.dart': _sampleInput('A', 'foo'), |
| 31 'a|web/test2.dart': _sampleOutput('B', 'bar'), | 30 'a|web/test2.dart': _sampleOutput('B', 'bar'), |
| 32 }, { | 31 }, { |
| 33 'a|web/test.dart': _sampleOutput('A', 'foo'), | 32 'a|web/test.dart': _sampleOutput('A', 'foo'), |
| 34 'a|web/test2.dart': _sampleOutput('B', 'bar'), | 33 'a|web/test2.dart': _sampleOutput('B', 'bar'), |
| 35 }); | 34 }); |
| 36 | 35 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 i2.m_car, | 167 i2.m_car, |
| 169 () => Polymer.register('x-C', i2.XC), | 168 () => Polymer.register('x-C', i2.XC), |
| 170 ]); | 169 ]); |
| 171 i2.main(); | 170 i2.main(); |
| 172 } | 171 } |
| 173 '''.replaceAll('\n ', '\n'), | 172 '''.replaceAll('\n ', '\n'), |
| 174 'a|web/a.dart': _sampleOutput('A', 'foo'), | 173 'a|web/a.dart': _sampleOutput('A', 'foo'), |
| 175 }, [ | 174 }, [ |
| 176 // These should not be emitted multiple times. See: | 175 // These should not be emitted multiple times. See: |
| 177 // https://code.google.com/p/dart/issues/detail?id=17197 | 176 // https://code.google.com/p/dart/issues/detail?id=17197 |
| 178 'warning: $ONLY_ONE_TAG (web/test.html 2 0)', | 177 'warning: ${ONLY_ONE_TAG.snippet} (web/test.html 2 0)', |
| 179 'warning: $ONLY_ONE_TAG (web/test.html 18 0)', | 178 'warning: ${ONLY_ONE_TAG.snippet} (web/test.html 18 0)', |
| 180 'warning: $ONLY_ONE_TAG (web/test.html 34 0)', | 179 'warning: ${ONLY_ONE_TAG.snippet} (web/test.html 34 0)', |
| 181 'warning: Script file at "d.dart" not found. (web/test.html 34 0)', | 180 'warning: Script file at "d.dart" not found. (web/test.html 34 0)', |
| 182 ]); | 181 ]); |
| 183 | 182 |
| 184 testPhases('with imports', phases, { | 183 testPhases('with imports', phases, { |
| 185 'a|web/index.html': | 184 'a|web/index.html': |
| 186 '<!DOCTYPE html><html><head>' | 185 '<!DOCTYPE html><html><head>' |
| 187 '<link rel="import" href="packages/polymer/polymer.html">' | 186 '<link rel="import" href="packages/polymer/polymer.html">' |
| 188 '<link rel="import" href="packages/a/test2.html">' | 187 '<link rel="import" href="packages/a/test2.html">' |
| 189 '</head><body>' | 188 '</head><body>' |
| 190 '<script type="application/dart" src="b.dart"></script>', | 189 '<script type="application/dart" src="b.dart"></script>', |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 332 } |
| 334 | 333 |
| 335 @CustomTag('x-$className') | 334 @CustomTag('x-$className') |
| 336 class X${className} extends PolymerElement { | 335 class X${className} extends PolymerElement { |
| 337 X${className}.created() : super.created(); | 336 X${className}.created() : super.created(); |
| 338 } | 337 } |
| 339 @initMethod m_$fieldName() {} | 338 @initMethod m_$fieldName() {} |
| 340 main() {} | 339 main() {} |
| 341 '''; | 340 '''; |
| 342 } | 341 } |
| OLD | NEW |