OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library polymer.test.transform.script_compactor_test; | |
6 | |
7 import 'package:polymer/src/transform/common.dart'; | |
8 import 'package:polymer/src/transform/script_compactor.dart'; | |
9 import 'package:unittest/compact_vm_config.dart'; | |
10 | |
11 import 'common.dart'; | |
12 | |
13 void main() { | |
14 useCompactVMConfiguration(); | |
15 var phases = [[new ScriptCompactor(new TransformOptions())]]; | |
16 | |
17 testPhases('no changes', phases, { | |
18 'a|web/test.html': '<!DOCTYPE html><html></html>', | |
19 }, { | |
20 'a|web/test.html': '<!DOCTYPE html><html></html>', | |
21 }); | |
22 | |
23 testPhases('no changes outside web/', phases, { | |
24 'a|lib/test.html': | |
25 '<!DOCTYPE html><html><head>' | |
26 '<script type="application/dart" src="a.dart"></script>', | |
27 }, { | |
28 'a|lib/test.html': | |
29 '<!DOCTYPE html><html><head>' | |
30 '<script type="application/dart" src="a.dart"></script>', | |
31 }); | |
32 | |
33 testPhases('single script', phases, { | |
34 'a|web/test.html': | |
35 '<!DOCTYPE html><html><head>' | |
36 '<script type="application/dart" src="a.dart"></script>', | |
37 }, { | |
38 'a|web/test.html': | |
39 '<!DOCTYPE html><html><head></head><body>' | |
40 '<script type="application/dart" ' | |
41 'src="test.html_bootstrap.dart"></script>' | |
42 '<script src="packages/browser/dart.js"></script>' | |
43 '</body></html>', | |
44 | |
45 'a|web/test.html_bootstrap.dart': | |
46 '''library app_bootstrap; | |
47 | |
48 import 'package:polymer/polymer.dart'; | |
49 import 'dart:mirrors' show currentMirrorSystem; | |
50 | |
51 import 'a.dart' as i0; | |
52 | |
53 void main() { | |
54 initPolymer([ | |
55 'a.dart', | |
56 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | |
57 } | |
58 '''.replaceAll('\n ', '\n'), | |
59 }); | |
60 | |
61 testPhases('several scripts', phases, { | |
62 'a|web/test.html': | |
63 '<!DOCTYPE html><html><head>' | |
64 '<script type="application/dart" src="a.dart"></script>' | |
65 '<script type="application/dart" src="b.dart"></script>' | |
66 '</head><body><div>' | |
67 '<script type="application/dart" src="c.dart"></script>' | |
68 '</div>' | |
69 '<script type="application/dart" src="d.dart"></script>', | |
70 }, { | |
71 'a|web/test.html': | |
72 '<!DOCTYPE html><html><head></head><body><div></div>' | |
73 '<script type="application/dart" ' | |
74 'src="test.html_bootstrap.dart"></script>' | |
75 '<script src="packages/browser/dart.js"></script>' | |
76 '</body></html>', | |
77 | |
78 'a|web/test.html_bootstrap.dart': | |
79 '''library app_bootstrap; | |
80 | |
81 import 'package:polymer/polymer.dart'; | |
82 import 'dart:mirrors' show currentMirrorSystem; | |
83 | |
84 import 'a.dart' as i0; | |
85 import 'b.dart' as i1; | |
86 import 'c.dart' as i2; | |
87 import 'd.dart' as i3; | |
88 | |
89 void main() { | |
90 initPolymer([ | |
91 'a.dart', | |
92 'b.dart', | |
93 'c.dart', | |
94 'd.dart', | |
95 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | |
96 } | |
97 '''.replaceAll('\n ', '\n'), | |
98 }); | |
99 } | |
OLD | NEW |