| 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/transformer.dart'; | 7 import 'package:polymer/transformer.dart'; |
| 8 import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER; |
| 8 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
| 9 | 10 |
| 10 import 'common.dart'; | 11 import 'common.dart'; |
| 11 | 12 |
| 12 void main() { | 13 void main() { |
| 13 useCompactVMConfiguration(); | 14 useCompactVMConfiguration(); |
| 14 var phases = createDeployPhases(new TransformOptions()); | 15 var phases = createDeployPhases(new TransformOptions()); |
| 15 | 16 |
| 16 testPhases('no changes', phases, { | 17 testPhases('no changes', phases, { |
| 17 'a|web/test.html': '<!DOCTYPE html><html></html>', | 18 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| (...skipping 19 matching lines...) Expand all Loading... |
| 37 '<!DOCTYPE html><html><head></head><body>' | 38 '<!DOCTYPE html><html><head></head><body>' |
| 38 '$SHADOW_DOM_TAG' | 39 '$SHADOW_DOM_TAG' |
| 39 '$CUSTOM_ELEMENT_TAG' | 40 '$CUSTOM_ELEMENT_TAG' |
| 40 '$INTEROP_TAG' | 41 '$INTEROP_TAG' |
| 41 '<script type="application/dart" ' | 42 '<script type="application/dart" ' |
| 42 'src="test.html_bootstrap.dart"></script>' | 43 'src="test.html_bootstrap.dart"></script>' |
| 43 '<script src="packages/browser/dart.js"></script>' | 44 '<script src="packages/browser/dart.js"></script>' |
| 44 '</body></html>', | 45 '</body></html>', |
| 45 | 46 |
| 46 'a|web/test.html_bootstrap.dart': | 47 'a|web/test.html_bootstrap.dart': |
| 47 '''library app_bootstrap; | 48 '''$MAIN_HEADER |
| 48 | |
| 49 import 'package:polymer/polymer.dart'; | |
| 50 import 'dart:mirrors' show currentMirrorSystem; | |
| 51 | |
| 52 import 'a.dart' as i0; | 49 import 'a.dart' as i0; |
| 53 | 50 |
| 54 void main() { | 51 void main() { |
| 55 initPolymer([ | 52 initPolymer([ |
| 56 'a.dart', | 53 'a.dart', |
| 57 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | 54 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); |
| 58 } | 55 } |
| 59 '''.replaceAll('\n ', '\n'), | 56 '''.replaceAll('\n ', '\n'), |
| 60 'a|web/test.dart': _sampleObservableOutput('A', 'foo'), | 57 'a|web/test.dart': _sampleObservableOutput('A', 'foo'), |
| 61 }); | 58 }); |
| 62 | 59 |
| 63 testPhases('single inline script', phases, { | 60 testPhases('single inline script', phases, { |
| 64 'a|web/test.html': | 61 'a|web/test.html': |
| 65 '<!DOCTYPE html><html><head>' | 62 '<!DOCTYPE html><html><head>' |
| 66 '<script type="application/dart">' | 63 '<script type="application/dart">' |
| 67 '${_sampleObservable("B", "bar")}</script>', | 64 '${_sampleObservable("B", "bar")}</script>', |
| 68 }, { | 65 }, { |
| 69 'a|web/test.html': | 66 'a|web/test.html': |
| 70 '<!DOCTYPE html><html><head></head><body>' | 67 '<!DOCTYPE html><html><head></head><body>' |
| 71 '$SHADOW_DOM_TAG' | 68 '$SHADOW_DOM_TAG' |
| 72 '$CUSTOM_ELEMENT_TAG' | 69 '$CUSTOM_ELEMENT_TAG' |
| 73 '$INTEROP_TAG' | 70 '$INTEROP_TAG' |
| 74 '<script type="application/dart" ' | 71 '<script type="application/dart" ' |
| 75 'src="test.html_bootstrap.dart"></script>' | 72 'src="test.html_bootstrap.dart"></script>' |
| 76 '<script src="packages/browser/dart.js"></script>' | 73 '<script src="packages/browser/dart.js"></script>' |
| 77 '</body></html>', | 74 '</body></html>', |
| 78 | 75 |
| 79 'a|web/test.html_bootstrap.dart': | 76 'a|web/test.html_bootstrap.dart': |
| 80 '''library app_bootstrap; | 77 '''$MAIN_HEADER |
| 81 | |
| 82 import 'package:polymer/polymer.dart'; | |
| 83 import 'dart:mirrors' show currentMirrorSystem; | |
| 84 | |
| 85 import 'test.html.0.dart' as i0; | 78 import 'test.html.0.dart' as i0; |
| 86 | 79 |
| 87 void main() { | 80 void main() { |
| 88 initPolymer([ | 81 initPolymer([ |
| 89 'test.html.0.dart', | 82 'test.html.0.dart', |
| 90 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | 83 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); |
| 91 } | 84 } |
| 92 '''.replaceAll('\n ', '\n'), | 85 '''.replaceAll('\n ', '\n'), |
| 93 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), | 86 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), |
| 94 }); | 87 }); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 '$SHADOW_DOM_TAG' | 104 '$SHADOW_DOM_TAG' |
| 112 '$CUSTOM_ELEMENT_TAG' | 105 '$CUSTOM_ELEMENT_TAG' |
| 113 '$INTEROP_TAG' | 106 '$INTEROP_TAG' |
| 114 '<div></div>' | 107 '<div></div>' |
| 115 '<script type="application/dart" ' | 108 '<script type="application/dart" ' |
| 116 'src="test.html_bootstrap.dart"></script>' | 109 'src="test.html_bootstrap.dart"></script>' |
| 117 '<script src="packages/browser/dart.js"></script>' | 110 '<script src="packages/browser/dart.js"></script>' |
| 118 '</body></html>', | 111 '</body></html>', |
| 119 | 112 |
| 120 'a|web/test.html_bootstrap.dart': | 113 'a|web/test.html_bootstrap.dart': |
| 121 '''library app_bootstrap; | 114 '''$MAIN_HEADER |
| 122 | |
| 123 import 'package:polymer/polymer.dart'; | |
| 124 import 'dart:mirrors' show currentMirrorSystem; | |
| 125 | |
| 126 import 'a.dart' as i0; | 115 import 'a.dart' as i0; |
| 127 import 'test.html.0.dart' as i1; | 116 import 'test.html.0.dart' as i1; |
| 128 import 'test.html.1.dart' as i2; | 117 import 'test.html.1.dart' as i2; |
| 129 import 'd.dart' as i3; | 118 import 'd.dart' as i3; |
| 130 | 119 |
| 131 void main() { | 120 void main() { |
| 132 initPolymer([ | 121 initPolymer([ |
| 133 'a.dart', | 122 'a.dart', |
| 134 'test.html.0.dart', | 123 'test.html.0.dart', |
| 135 'test.html.1.dart', | 124 'test.html.1.dart', |
| (...skipping 26 matching lines...) Expand all Loading... |
| 162 '<!DOCTYPE html><html><head></head><body>' | 151 '<!DOCTYPE html><html><head></head><body>' |
| 163 '$SHADOW_DOM_TAG' | 152 '$SHADOW_DOM_TAG' |
| 164 '$CUSTOM_ELEMENT_TAG' | 153 '$CUSTOM_ELEMENT_TAG' |
| 165 '$INTEROP_TAG' | 154 '$INTEROP_TAG' |
| 166 '<polymer-element>1</polymer-element>' | 155 '<polymer-element>1</polymer-element>' |
| 167 '<script type="application/dart" ' | 156 '<script type="application/dart" ' |
| 168 'src="index.html_bootstrap.dart"></script>' | 157 'src="index.html_bootstrap.dart"></script>' |
| 169 '<script src="packages/browser/dart.js"></script>' | 158 '<script src="packages/browser/dart.js"></script>' |
| 170 '</body></html>', | 159 '</body></html>', |
| 171 'a|web/index.html_bootstrap.dart': | 160 'a|web/index.html_bootstrap.dart': |
| 172 '''library app_bootstrap; | 161 '''$MAIN_HEADER |
| 173 | |
| 174 import 'package:polymer/polymer.dart'; | |
| 175 import 'dart:mirrors' show currentMirrorSystem; | |
| 176 | |
| 177 import 'test2.html.0.dart' as i0; | 162 import 'test2.html.0.dart' as i0; |
| 178 import 'b.dart' as i1; | 163 import 'b.dart' as i1; |
| 179 import 'index.html.0.dart' as i2; | 164 import 'index.html.0.dart' as i2; |
| 180 | 165 |
| 181 void main() { | 166 void main() { |
| 182 initPolymer([ | 167 initPolymer([ |
| 183 'test2.html.0.dart', | 168 'test2.html.0.dart', |
| 184 'b.dart', | 169 'b.dart', |
| 185 'index.html.0.dart', | 170 'index.html.0.dart', |
| 186 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | 171 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 199 class $className extends ObservableBase { | 184 class $className extends ObservableBase { |
| 200 @observable int $fieldName; | 185 @observable int $fieldName; |
| 201 $className(this.$fieldName); | 186 $className(this.$fieldName); |
| 202 } | 187 } |
| 203 '''; | 188 '''; |
| 204 | 189 |
| 205 String _sampleObservableOutput(String className, String field) => | 190 String _sampleObservableOutput(String className, String field) => |
| 206 "library ${className}_$field;\n" | 191 "library ${className}_$field;\n" |
| 207 "import 'package:observe/observe.dart';\n\n" | 192 "import 'package:observe/observe.dart';\n\n" |
| 208 "class $className extends ChangeNotifierBase {\n" | 193 "class $className extends ChangeNotifierBase {\n" |
| 209 " @observable int get $field => __\$$field; " | 194 " @reflectable @observable int get $field => __\$$field; " |
| 210 "int __\$$field; " | 195 "int __\$$field; " |
| 211 "set $field(int value) { " | 196 "@reflectable set $field(int value) { " |
| 212 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " | 197 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " |
| 213 "}\n" | 198 "}\n" |
| 214 " $className($field) : __\$$field = $field;\n" | 199 " $className($field) : __\$$field = $field;\n" |
| 215 "}\n"; | 200 "}\n"; |
| OLD | NEW |