| 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'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 '$INTEROP_TAG' | 42 '$INTEROP_TAG' |
| 43 '<script src="test.html_bootstrap.dart.js"></script>' | 43 '<script src="test.html_bootstrap.dart.js"></script>' |
| 44 '</head><body></body></html>', | 44 '</head><body></body></html>', |
| 45 | 45 |
| 46 'a|web/test.html_bootstrap.dart': | 46 'a|web/test.html_bootstrap.dart': |
| 47 '''$MAIN_HEADER | 47 '''$MAIN_HEADER |
| 48 import 'a.dart' as i0; | 48 import 'a.dart' as i0; |
| 49 | 49 |
| 50 void main() { | 50 void main() { |
| 51 configureForDeployment([ | 51 configureForDeployment([ |
| 52 'a.dart', | |
| 53 ]); | 52 ]); |
| 54 i0.main(); | 53 i0.main(); |
| 55 } | 54 } |
| 56 '''.replaceAll('\n ', '\n'), | 55 '''.replaceAll('\n ', '\n'), |
| 57 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), | 56 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), |
| 58 }); | 57 }); |
| 59 | 58 |
| 60 testPhases('single inline script', phases, { | 59 testPhases('single inline script', phases, { |
| 61 'a|web/test.html': | 60 'a|web/test.html': |
| 62 '<!DOCTYPE html><html><head>' | 61 '<!DOCTYPE html><html><head>' |
| 63 '<script type="application/dart">' | 62 '<script type="application/dart">' |
| 64 '${_sampleObservable("B", "bar")}</script>', | 63 '${_sampleObservable("B", "bar")}</script>', |
| 65 }, { | 64 }, { |
| 66 'a|web/test.html': | 65 'a|web/test.html': |
| 67 '<!DOCTYPE html><html><head>' | 66 '<!DOCTYPE html><html><head>' |
| 68 '$SHADOW_DOM_TAG' | 67 '$SHADOW_DOM_TAG' |
| 69 '$CUSTOM_ELEMENT_TAG' | 68 '$CUSTOM_ELEMENT_TAG' |
| 70 '$INTEROP_TAG' | 69 '$INTEROP_TAG' |
| 71 '<script src="test.html_bootstrap.dart.js"></script>' | 70 '<script src="test.html_bootstrap.dart.js"></script>' |
| 72 '</head><body></body></html>', | 71 '</head><body></body></html>', |
| 73 | 72 |
| 74 'a|web/test.html_bootstrap.dart': | 73 'a|web/test.html_bootstrap.dart': |
| 75 '''$MAIN_HEADER | 74 '''$MAIN_HEADER |
| 76 import 'test.html.0.dart' as i0; | 75 import 'test.html.0.dart' as i0; |
| 77 | 76 |
| 78 void main() { | 77 void main() { |
| 79 configureForDeployment([ | 78 configureForDeployment([ |
| 80 'test.html.0.dart', | |
| 81 ]); | 79 ]); |
| 82 i0.main(); | 80 i0.main(); |
| 83 } | 81 } |
| 84 '''.replaceAll('\n ', '\n'), | 82 '''.replaceAll('\n ', '\n'), |
| 85 'a|web/test.html.0.dart': | 83 'a|web/test.html.0.dart': |
| 86 _sampleObservableOutput("B", "bar"), | 84 _sampleObservableOutput("B", "bar"), |
| 87 }); | 85 }); |
| 88 | 86 |
| 89 testPhases('several scripts', phases, { | 87 testPhases('several scripts', phases, { |
| 90 'a|web/test.html': | 88 'a|web/test.html': |
| (...skipping 21 matching lines...) Expand all Loading... |
| 112 '</head><body>' | 110 '</head><body>' |
| 113 '<div></div>' | 111 '<div></div>' |
| 114 '</body></html>', | 112 '</body></html>', |
| 115 | 113 |
| 116 'a|web/test.html_bootstrap.dart': | 114 'a|web/test.html_bootstrap.dart': |
| 117 '''$MAIN_HEADER | 115 '''$MAIN_HEADER |
| 118 import 'a.dart' as i0; | 116 import 'a.dart' as i0; |
| 119 | 117 |
| 120 void main() { | 118 void main() { |
| 121 configureForDeployment([ | 119 configureForDeployment([ |
| 122 'a.dart', | |
| 123 ]); | 120 ]); |
| 124 i0.main(); | 121 i0.main(); |
| 125 } | 122 } |
| 126 '''.replaceAll('\n ', '\n'), | 123 '''.replaceAll('\n ', '\n'), |
| 127 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), | 124 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), |
| 128 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), | 125 'a|web/test.html.0.dart': _sampleObservableOutput("B", "bar"), |
| 129 'a|web/test.html.1.dart': _sampleObservableOutput("C", "car"), | 126 'a|web/test.html.1.dart': _sampleObservableOutput("C", "car"), |
| 130 }); | 127 }); |
| 131 | 128 |
| 132 testPhases('with imports', phases, { | 129 testPhases('with imports', phases, { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 151 '</head><body><polymer-element>1</polymer-element>' | 148 '</head><body><polymer-element>1</polymer-element>' |
| 152 '<script src="index.html_bootstrap.dart.js"></script>' | 149 '<script src="index.html_bootstrap.dart.js"></script>' |
| 153 '</body></html>', | 150 '</body></html>', |
| 154 'a|web/index.html_bootstrap.dart': | 151 'a|web/index.html_bootstrap.dart': |
| 155 '''$MAIN_HEADER | 152 '''$MAIN_HEADER |
| 156 import 'test2.html.0.dart' as i0; | 153 import 'test2.html.0.dart' as i0; |
| 157 import 'b.dart' as i1; | 154 import 'b.dart' as i1; |
| 158 | 155 |
| 159 void main() { | 156 void main() { |
| 160 configureForDeployment([ | 157 configureForDeployment([ |
| 161 'test2.html.0.dart', | |
| 162 'b.dart', | |
| 163 ]); | 158 ]); |
| 164 i1.main(); | 159 i1.main(); |
| 165 } | 160 } |
| 166 '''.replaceAll('\n ', '\n'), | 161 '''.replaceAll('\n ', '\n'), |
| 167 'a|web/test2.html.0.dart': _sampleObservableOutput("A", "foo"), | 162 'a|web/test2.html.0.dart': _sampleObservableOutput("A", "foo"), |
| 168 'a|web/b.dart': _sampleObservableOutput('B', 'bar'), | 163 'a|web/b.dart': _sampleObservableOutput('B', 'bar'), |
| 169 }); | 164 }); |
| 170 } | 165 } |
| 171 | 166 |
| 172 String _sampleObservable(String className, String fieldName) => ''' | 167 String _sampleObservable(String className, String fieldName) => ''' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 184 "library ${className}_$field;\n" | 179 "library ${className}_$field;\n" |
| 185 "import 'package:observe/observe.dart';\n\n" | 180 "import 'package:observe/observe.dart';\n\n" |
| 186 "class $className extends ChangeNotifier {\n" | 181 "class $className extends ChangeNotifier {\n" |
| 187 " @reflectable @observable int get $field => __\$$field; " | 182 " @reflectable @observable int get $field => __\$$field; " |
| 188 "int __\$$field; " | 183 "int __\$$field; " |
| 189 "@reflectable set $field(int value) { " | 184 "@reflectable set $field(int value) { " |
| 190 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " | 185 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " |
| 191 "}\n" | 186 "}\n" |
| 192 " $className($field) : __\$$field = $field;\n" | 187 " $className($field) : __\$$field = $field;\n" |
| 193 "}\n"; | 188 "}\n"; |
| OLD | NEW |