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 19 matching lines...) Expand all Loading... |
30 }); | 30 }); |
31 | 31 |
32 testPhases('single script', phases, { | 32 testPhases('single script', phases, { |
33 'a|web/test.html': | 33 'a|web/test.html': |
34 '<!DOCTYPE html><html><head>' | 34 '<!DOCTYPE html><html><head>' |
35 '<script type="application/dart" src="a.dart"></script>', | 35 '<script type="application/dart" src="a.dart"></script>', |
36 'a|web/a.dart': _sampleObservable('A', 'foo'), | 36 'a|web/a.dart': _sampleObservable('A', 'foo'), |
37 }, { | 37 }, { |
38 'a|web/test.html': | 38 'a|web/test.html': |
39 '<!DOCTYPE html><html><head>' | 39 '<!DOCTYPE html><html><head>' |
40 '$SHADOW_DOM_TAG' | 40 '$WEB_COMPONENTS_TAG' |
41 '$CUSTOM_ELEMENT_TAG' | |
42 '$INTEROP_TAG' | 41 '$INTEROP_TAG' |
43 '<script src="test.html_bootstrap.dart.js"></script>' | 42 '<script src="test.html_bootstrap.dart.js"></script>' |
44 '</head><body></body></html>', | 43 '</head><body></body></html>', |
45 | 44 |
46 'a|web/test.html_bootstrap.dart': | 45 'a|web/test.html_bootstrap.dart': |
47 '''$MAIN_HEADER | 46 '''$MAIN_HEADER |
48 import 'a.dart' as i0; | 47 import 'a.dart' as i0; |
49 | 48 |
50 void main() { | 49 void main() { |
51 configureForDeployment([ | 50 configureForDeployment([ |
52 ]); | 51 ]); |
53 i0.main(); | 52 i0.main(); |
54 } | 53 } |
55 '''.replaceAll('\n ', '\n'), | 54 '''.replaceAll('\n ', '\n'), |
56 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), | 55 'a|web/a.dart': _sampleObservableOutput('A', 'foo'), |
57 }); | 56 }); |
58 | 57 |
59 testPhases('single inline script', phases, { | 58 testPhases('single inline script', phases, { |
60 'a|web/test.html': | 59 'a|web/test.html': |
61 '<!DOCTYPE html><html><head>' | 60 '<!DOCTYPE html><html><head>' |
62 '<script type="application/dart">' | 61 '<script type="application/dart">' |
63 '${_sampleObservable("B", "bar")}</script>', | 62 '${_sampleObservable("B", "bar")}</script>', |
64 }, { | 63 }, { |
65 'a|web/test.html': | 64 'a|web/test.html': |
66 '<!DOCTYPE html><html><head>' | 65 '<!DOCTYPE html><html><head>' |
67 '$SHADOW_DOM_TAG' | 66 '$WEB_COMPONENTS_TAG' |
68 '$CUSTOM_ELEMENT_TAG' | |
69 '$INTEROP_TAG' | 67 '$INTEROP_TAG' |
70 '<script src="test.html_bootstrap.dart.js"></script>' | 68 '<script src="test.html_bootstrap.dart.js"></script>' |
71 '</head><body></body></html>', | 69 '</head><body></body></html>', |
72 | 70 |
73 'a|web/test.html_bootstrap.dart': | 71 'a|web/test.html_bootstrap.dart': |
74 '''$MAIN_HEADER | 72 '''$MAIN_HEADER |
75 import 'test.html.0.dart' as i0; | 73 import 'test.html.0.dart' as i0; |
76 | 74 |
77 void main() { | 75 void main() { |
78 configureForDeployment([ | 76 configureForDeployment([ |
(...skipping 17 matching lines...) Expand all Loading... |
96 '${_sampleObservable("B", "bar")}</script>' | 94 '${_sampleObservable("B", "bar")}</script>' |
97 '</head><body><div>' | 95 '</head><body><div>' |
98 '<script type="application/dart">' | 96 '<script type="application/dart">' |
99 '${_sampleObservable("C", "car")}</script>' | 97 '${_sampleObservable("C", "car")}</script>' |
100 '</div>' | 98 '</div>' |
101 '<script type="application/dart" src="d.dart"></script>', | 99 '<script type="application/dart" src="d.dart"></script>', |
102 'a|web/a.dart': _sampleObservable('A', 'foo'), | 100 'a|web/a.dart': _sampleObservable('A', 'foo'), |
103 }, { | 101 }, { |
104 'a|web/test.html': | 102 'a|web/test.html': |
105 '<!DOCTYPE html><html><head>' | 103 '<!DOCTYPE html><html><head>' |
106 '$SHADOW_DOM_TAG' | 104 '$WEB_COMPONENTS_TAG' |
107 '$CUSTOM_ELEMENT_TAG' | |
108 '$INTEROP_TAG' | 105 '$INTEROP_TAG' |
109 '<script src="test.html_bootstrap.dart.js"></script>' | 106 '<script src="test.html_bootstrap.dart.js"></script>' |
110 '</head><body>' | 107 '</head><body>' |
111 '<div></div>' | 108 '<div></div>' |
112 '</body></html>', | 109 '</body></html>', |
113 | 110 |
114 'a|web/test.html_bootstrap.dart': | 111 'a|web/test.html_bootstrap.dart': |
115 '''$MAIN_HEADER | 112 '''$MAIN_HEADER |
116 import 'a.dart' as i0; | 113 import 'a.dart' as i0; |
117 | 114 |
(...skipping 17 matching lines...) Expand all Loading... |
135 'a|web/b.dart': _sampleObservable('B', 'bar'), | 132 'a|web/b.dart': _sampleObservable('B', 'bar'), |
136 'a|web/test2.html': | 133 'a|web/test2.html': |
137 '<!DOCTYPE html><html><head></head><body>' | 134 '<!DOCTYPE html><html><head></head><body>' |
138 '<polymer-element>1' | 135 '<polymer-element>1' |
139 '<script type="application/dart">' | 136 '<script type="application/dart">' |
140 '${_sampleObservable("A", "foo")}</script>' | 137 '${_sampleObservable("A", "foo")}</script>' |
141 '</polymer-element></html>', | 138 '</polymer-element></html>', |
142 }, { | 139 }, { |
143 'a|web/index.html': | 140 'a|web/index.html': |
144 '<!DOCTYPE html><html><head>' | 141 '<!DOCTYPE html><html><head>' |
145 '$SHADOW_DOM_TAG' | 142 '$WEB_COMPONENTS_TAG' |
146 '$CUSTOM_ELEMENT_TAG' | |
147 '$INTEROP_TAG' | 143 '$INTEROP_TAG' |
148 '</head><body><polymer-element>1</polymer-element>' | 144 '</head><body><polymer-element>1</polymer-element>' |
149 '<script src="index.html_bootstrap.dart.js"></script>' | 145 '<script src="index.html_bootstrap.dart.js"></script>' |
150 '</body></html>', | 146 '</body></html>', |
151 'a|web/index.html_bootstrap.dart': | 147 'a|web/index.html_bootstrap.dart': |
152 '''$MAIN_HEADER | 148 '''$MAIN_HEADER |
153 import 'test2.html.0.dart' as i0; | 149 import 'test2.html.0.dart' as i0; |
154 import 'b.dart' as i1; | 150 import 'b.dart' as i1; |
155 | 151 |
156 void main() { | 152 void main() { |
(...skipping 22 matching lines...) Expand all Loading... |
179 "library ${className}_$field;\n" | 175 "library ${className}_$field;\n" |
180 "import 'package:observe/observe.dart';\n\n" | 176 "import 'package:observe/observe.dart';\n\n" |
181 "class $className extends ChangeNotifier {\n" | 177 "class $className extends ChangeNotifier {\n" |
182 " @reflectable @observable int get $field => __\$$field; " | 178 " @reflectable @observable int get $field => __\$$field; " |
183 "int __\$$field; " | 179 "int __\$$field; " |
184 "@reflectable set $field(int value) { " | 180 "@reflectable set $field(int value) { " |
185 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " | 181 "__\$$field = notifyPropertyChange(#$field, __\$$field, value); " |
186 "}\n" | 182 "}\n" |
187 " $className($field) : __\$$field = $field;\n" | 183 " $className($field) : __\$$field = $field;\n" |
188 "}\n"; | 184 "}\n"; |
OLD | NEW |