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.script_compactor_test; | 5 library polymer.test.build.script_compactor_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'; | 8 import 'package:polymer/src/build/script_compactor.dart'; |
9 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 '<script type="application/dart" ' | 43 '<script type="application/dart" ' |
44 'src="test.html_bootstrap.dart"></script>' | 44 'src="test.html_bootstrap.dart"></script>' |
45 '</head><body></body></html>', | 45 '</head><body></body></html>', |
46 | 46 |
47 'a|web/test.html_bootstrap.dart': | 47 'a|web/test.html_bootstrap.dart': |
48 '''$MAIN_HEADER | 48 '''$MAIN_HEADER |
49 import 'a.dart' as i0; | 49 import 'a.dart' as i0; |
50 | 50 |
51 void main() { | 51 void main() { |
52 configureForDeployment([ | 52 configureForDeployment([ |
53 'a.dart', | |
54 ]); | 53 ]); |
55 i0.main(); | 54 i0.main(); |
56 } | 55 } |
57 '''.replaceAll('\n ', '\n'), | 56 '''.replaceAll('\n ', '\n'), |
58 'a|web/a.dart': 'library a;\nmain(){}', | 57 'a|web/a.dart': 'library a;\nmain(){}', |
59 }); | 58 }); |
60 | 59 |
61 testPhases('several scripts', phases, { | 60 testPhases('several scripts', phases, { |
62 'a|web/test.html': | 61 'a|web/test.html': |
63 '<!DOCTYPE html><html><head>' | 62 '<!DOCTYPE html><html><head>' |
64 '</head><body><div>' | 63 '</head><body><div>' |
65 '<script type="application/dart" src="d.dart"></script>' | 64 '<script type="application/dart" src="d.dart"></script>' |
66 '</div>', | 65 '</div>', |
67 'a|web/test.html.scriptUrls': | 66 'a|web/test.html.scriptUrls': |
68 '[["a", "web/a.dart"],["a", "web/b.dart"],["a", "web/c.dart"]]', | 67 '[["a", "web/a.dart"],["a", "web/b.dart"],["a", "web/c.dart"]]', |
69 'a|web/d.dart': 'library d;\nmain(){}', | 68 'a|web/d.dart': 'library d;\nmain(){}\n@initMethod mD(){}', |
| 69 |
| 70 'a|web/a.dart': |
| 71 'import "package:polymer/polymer.dart";\n' |
| 72 '@initMethod mA(){}\n', |
| 73 |
| 74 'a|web/b.dart': |
| 75 'export "e.dart";\n' |
| 76 'export "f.dart" show XF1, mF1;\n' |
| 77 'export "g.dart" hide XG1, mG1;\n' |
| 78 'export "h.dart" show XH1, mH1 hide mH1, mH2;\n' |
| 79 '@initMethod mB(){}\n', |
| 80 |
| 81 'a|web/c.dart': |
| 82 'import "package:polymer/polymer.dart";\n' |
| 83 'part "c_part.dart"\n' |
| 84 '@CustomTag("x-c2") class XC2 {}\n', |
| 85 |
| 86 'a|web/c_part.dart': |
| 87 '@CustomTag("x-c1") class XC1 {}\n', |
| 88 |
| 89 'a|web/e.dart': |
| 90 'import "package:polymer/polymer.dart";\n' |
| 91 '@CustomTag("x-e") class XE {}\n' |
| 92 '@initMethod mE(){}\n', |
| 93 |
| 94 'a|web/f.dart': |
| 95 'import "package:polymer/polymer.dart";\n' |
| 96 '@CustomTag("x-f1") class XF1 {}\n' |
| 97 '@initMethod mF1(){}\n' |
| 98 '@CustomTag("x-f2") class XF2 {}\n' |
| 99 '@initMethod mF2(){}\n', |
| 100 |
| 101 'a|web/g.dart': |
| 102 'import "package:polymer/polymer.dart";\n' |
| 103 '@CustomTag("x-g1") class XG1 {}\n' |
| 104 '@initMethod mG1(){}\n' |
| 105 '@CustomTag("x-g2") class XG2 {}\n' |
| 106 '@initMethod mG2(){}\n', |
| 107 |
| 108 'a|web/h.dart': |
| 109 'import "package:polymer/polymer.dart";\n' |
| 110 '@CustomTag("x-h1") class XH1 {}\n' |
| 111 '@initMethod mH1(){}\n' |
| 112 '@CustomTag("x-h2") class XH2 {}\n' |
| 113 '@initMethod mH2(){}\n', |
70 }, { | 114 }, { |
71 'a|web/test.html': | 115 'a|web/test.html': |
72 '<!DOCTYPE html><html><head></head><body><div>' | 116 '<!DOCTYPE html><html><head></head><body><div>' |
73 '<script type="application/dart" src="test.html_bootstrap.dart">' | 117 '<script type="application/dart" src="test.html_bootstrap.dart">' |
74 '</script>' | 118 '</script>' |
75 '</div>' | 119 '</div>' |
76 '</body></html>', | 120 '</body></html>', |
77 | 121 |
78 'a|web/test.html_bootstrap.dart': | 122 'a|web/test.html_bootstrap.dart': |
79 '''$MAIN_HEADER | 123 '''$MAIN_HEADER |
80 import 'a.dart' as i0; | 124 import 'a.dart' as i0; |
81 import 'b.dart' as i1; | 125 import 'b.dart' as i1; |
82 import 'c.dart' as i2; | 126 import 'c.dart' as i2; |
83 import 'd.dart' as i3; | 127 import 'd.dart' as i3; |
84 | 128 |
85 void main() { | 129 void main() { |
86 configureForDeployment([ | 130 configureForDeployment([ |
87 'a.dart', | 131 i0.mA, |
88 'b.dart', | 132 () => Polymer.register('x-e', i1.XE), |
89 'c.dart', | 133 i1.mE, |
90 'd.dart', | 134 () => Polymer.register('x-f1', i1.XF1), |
| 135 i1.mF1, |
| 136 () => Polymer.register('x-g2', i1.XG2), |
| 137 i1.mG2, |
| 138 () => Polymer.register('x-h1', i1.XH1), |
| 139 i1.mB, |
| 140 () => Polymer.register('x-c1', i2.XC1), |
| 141 () => Polymer.register('x-c2', i2.XC2), |
| 142 i3.mD, |
91 ]); | 143 ]); |
92 i3.main(); | 144 i3.main(); |
93 } | 145 } |
94 '''.replaceAll('\n ', '\n'), | 146 '''.replaceAll('\n ', '\n'), |
95 }); | 147 }); |
96 } | 148 } |
OLD | NEW |