| 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:polymer/src/build/common.dart'; | 7 import 'package:polymer/src/build/common.dart'; |
| 8 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; | 8 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; |
| 9 import 'package:polymer/transformer.dart'; | 9 import 'package:polymer/transformer.dart'; |
| 10 import 'package:unittest/compact_vm_config.dart'; | 10 import 'package:unittest/compact_vm_config.dart'; |
| 11 | 11 |
| 12 import 'common.dart'; | 12 import 'common.dart'; |
| 13 | 13 |
| 14 void main() { | 14 void main() { |
| 15 useCompactVMConfiguration(); | 15 useCompactVMConfiguration(); |
| 16 var phases = new PolymerTransformerGroup(new TransformOptions()).phases; | 16 var phases = new PolymerTransformerGroup(new TransformOptions()).phases; |
| 17 | 17 |
| 18 testPhases('no changes', phases, { | 18 testPhases('no changes', phases, { |
| 19 'a|web/test.html': '<!DOCTYPE html><html></html>', | 19 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| 20 }, { | 20 }, {}, [ |
| 21 'a|web/test.html': '<!DOCTYPE html><html></html>', | 21 'error: To run a polymer application, you need to call "initPolymer". You' |
| 22 }); | 22 ' can either include a generic script tag that does this for you:\'<' |
| 23 'script type="application/dart">export "package:polymer/init.dart";' |
| 24 '</script>\' or add your own script tag and call that function. Make sure' |
| 25 ' the script tag is placed after all HTML imports.' |
| 26 ]); |
| 23 | 27 |
| 24 testPhases('observable changes', phases, { | 28 testPhases('observable changes', phases, { |
| 25 'a|web/test.dart': _sampleObservable('A', 'foo'), | 29 'a|web/test.dart': _sampleObservable('A', 'foo'), |
| 26 'a|web/test2.dart': _sampleObservableOutput('B', 'bar'), | 30 'a|web/test2.dart': _sampleObservableOutput('B', 'bar'), |
| 27 }, { | 31 }, { |
| 28 'a|web/test.dart': _sampleObservableOutput('A', 'foo'), | 32 'a|web/test.dart': _sampleObservableOutput('A', 'foo'), |
| 29 'a|web/test2.dart': _sampleObservableOutput('B', 'bar'), | 33 'a|web/test2.dart': _sampleObservableOutput('B', 'bar'), |
| 30 }); | 34 }); |
| 31 | 35 |
| 32 testPhases('single script', phases, { | 36 testPhases('single script', phases, { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 143 |
| 140 testPhases('with imports', phases, { | 144 testPhases('with imports', phases, { |
| 141 'a|web/index.html': | 145 'a|web/index.html': |
| 142 '<!DOCTYPE html><html><head>' | 146 '<!DOCTYPE html><html><head>' |
| 143 '<link rel="import" href="test2.html">' | 147 '<link rel="import" href="test2.html">' |
| 144 '</head><body>' | 148 '</head><body>' |
| 145 '<script type="application/dart" src="b.dart"></script>', | 149 '<script type="application/dart" src="b.dart"></script>', |
| 146 'a|web/b.dart': _sampleObservable('B', 'bar'), | 150 'a|web/b.dart': _sampleObservable('B', 'bar'), |
| 147 'a|web/test2.html': | 151 'a|web/test2.html': |
| 148 '<!DOCTYPE html><html><head></head><body>' | 152 '<!DOCTYPE html><html><head></head><body>' |
| 149 '<polymer-element>1' | 153 '<polymer-element name="x-a">1' |
| 150 '<script type="application/dart">' | 154 '<script type="application/dart">' |
| 151 '${_sampleObservable("A", "foo")}</script>' | 155 '${_sampleObservable("A", "foo")}</script>' |
| 152 '</polymer-element></html>', | 156 '</polymer-element></html>', |
| 153 }, { | 157 }, { |
| 154 'a|web/index.html': | 158 'a|web/index.html': |
| 155 '<!DOCTYPE html><html><head>' | 159 '<!DOCTYPE html><html><head>' |
| 156 '$WEB_COMPONENTS_TAG' | 160 '$WEB_COMPONENTS_TAG' |
| 157 '$INTEROP_TAG' | 161 '$INTEROP_TAG' |
| 158 '</head><body><polymer-element>1</polymer-element>' | 162 '</head><body><polymer-element name="x-a">1</polymer-element>' |
| 159 '<script src="index.html_bootstrap.dart.js"></script>' | 163 '<script src="index.html_bootstrap.dart.js"></script>' |
| 160 '</body></html>', | 164 '</body></html>', |
| 161 'a|web/index.html_bootstrap.dart': | 165 'a|web/index.html_bootstrap.dart': |
| 162 '''$MAIN_HEADER | 166 '''$MAIN_HEADER |
| 163 import 'index.html.0.dart' as i0; | 167 import 'index.html.0.dart' as i0; |
| 164 import 'b.dart' as i1; | 168 import 'b.dart' as i1; |
| 165 | 169 |
| 166 void main() { | 170 void main() { |
| 167 configureForDeployment([ | 171 configureForDeployment([ |
| 168 ]); | 172 ]); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 189 "library ${className}_$field;\n" | 193 "library ${className}_$field;\n" |
| 190 "import 'package:observe/observe.dart';\n\n" | 194 "import 'package:observe/observe.dart';\n\n" |
| 191 "class $className extends ChangeNotifier {\n" | 195 "class $className extends ChangeNotifier {\n" |
| 192 " @reflectable @observable int get $field => __\$$field; " | 196 " @reflectable @observable int get $field => __\$$field; " |
| 193 "int __\$$field; " | 197 "int __\$$field; " |
| 194 "@reflectable set $field(int value) { " | 198 "@reflectable set $field(int value) { " |
| 195 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " | 199 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " |
| 196 "}\n" | 200 "}\n" |
| 197 " $className($field) : __\$$field = $field;\n" | 201 " $className($field) : __\$$field = $field;\n" |
| 198 "}\n"; | 202 "}\n"; |
| OLD | NEW |