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.transform.script_compactor_test; | 5 library polymer.test.transform.script_compactor_test; |
6 | 6 |
7 import 'package:polymer/src/transform/script_compactor.dart'; | 7 import 'package:polymer/src/transform/script_compactor.dart'; |
8 import 'package:unittest/compact_vm_config.dart'; | 8 import 'package:unittest/compact_vm_config.dart'; |
9 | 9 |
10 import 'common.dart'; | 10 import 'common.dart'; |
11 | 11 |
12 void main() { | 12 void main() { |
13 useCompactVMConfiguration(); | 13 useCompactVMConfiguration(); |
14 | 14 |
15 testPhases('no changes', [[new ScriptCompactor()]], { | 15 testPhases('no changes', [[new ScriptCompactor()]], { |
16 'a|test.html': '<!DOCTYPE html><html></html>', | 16 'a|test.html': '<!DOCTYPE html><html></html>', |
17 }, { | 17 }, { |
18 'a|test.html': '<!DOCTYPE html><html></html>', | 18 'a|test.html': '<!DOCTYPE html><html></html>', |
19 }); | 19 }); |
20 | 20 |
21 testPhases('single script', [[new ScriptCompactor()]], { | 21 testPhases('single script', [[new ScriptCompactor()]], { |
22 'a|test.html': | 22 'a|test.html': |
23 '<!DOCTYPE html><html><head>' | 23 '<!DOCTYPE html><html><head>' |
24 '<script type="application/dart" src="a.dart"></script>', | 24 '<script type="application/dart" src="a.dart"></script>', |
25 }, { | 25 }, { |
26 'a|test.html': | 26 'a|test.html': |
27 '<!DOCTYPE html><html><head></head><body>' | 27 '<!DOCTYPE html><html><head></head><body>' |
28 '<script type="application/dart" ' | 28 '<script type="application/dart" ' |
29 'src="test.html_bootstrap.dart"></script>' | 29 'src="test.html_bootstrap.dart"></script>' |
| 30 '<script type="text/javascript" ' |
| 31 'src="packages/browser/dart.js"></script>' |
30 '</body></html>', | 32 '</body></html>', |
31 | 33 |
32 'a|test.html_bootstrap.dart': | 34 'a|test.html_bootstrap.dart': |
33 '''library app_bootstrap; | 35 '''library app_bootstrap; |
34 | 36 |
35 import 'package:polymer/polymer.dart'; | 37 import 'package:polymer/polymer.dart'; |
36 import 'dart:mirrors' show currentMirrorSystem; | 38 import 'dart:mirrors' show currentMirrorSystem; |
37 | 39 |
38 import 'a.dart' as i0; | 40 import 'a.dart' as i0; |
39 | 41 |
(...skipping 12 matching lines...) Expand all Loading... |
52 '<script type="application/dart" src="b.dart"></script>' | 54 '<script type="application/dart" src="b.dart"></script>' |
53 '</head><body><div>' | 55 '</head><body><div>' |
54 '<script type="application/dart" src="c.dart"></script>' | 56 '<script type="application/dart" src="c.dart"></script>' |
55 '</div>' | 57 '</div>' |
56 '<script type="application/dart" src="d.dart"></script>', | 58 '<script type="application/dart" src="d.dart"></script>', |
57 }, { | 59 }, { |
58 'a|test.html': | 60 'a|test.html': |
59 '<!DOCTYPE html><html><head></head><body><div></div>' | 61 '<!DOCTYPE html><html><head></head><body><div></div>' |
60 '<script type="application/dart" ' | 62 '<script type="application/dart" ' |
61 'src="test.html_bootstrap.dart"></script>' | 63 'src="test.html_bootstrap.dart"></script>' |
| 64 '<script type="text/javascript" ' |
| 65 'src="packages/browser/dart.js"></script>' |
62 '</body></html>', | 66 '</body></html>', |
63 | 67 |
64 'a|test.html_bootstrap.dart': | 68 'a|test.html_bootstrap.dart': |
65 '''library app_bootstrap; | 69 '''library app_bootstrap; |
66 | 70 |
67 import 'package:polymer/polymer.dart'; | 71 import 'package:polymer/polymer.dart'; |
68 import 'dart:mirrors' show currentMirrorSystem; | 72 import 'dart:mirrors' show currentMirrorSystem; |
69 | 73 |
70 import 'a.dart' as i0; | 74 import 'a.dart' as i0; |
71 import 'b.dart' as i1; | 75 import 'b.dart' as i1; |
72 import 'c.dart' as i2; | 76 import 'c.dart' as i2; |
73 import 'd.dart' as i3; | 77 import 'd.dart' as i3; |
74 | 78 |
75 void main() { | 79 void main() { |
76 initPolymer([ | 80 initPolymer([ |
77 'a.dart', | 81 'a.dart', |
78 'b.dart', | 82 'b.dart', |
79 'c.dart', | 83 'c.dart', |
80 'd.dart', | 84 'd.dart', |
81 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); | 85 ], currentMirrorSystem().isolate.rootLibrary.uri.toString()); |
82 } | 86 } |
83 '''.replaceAll('\n ', '\n'), | 87 '''.replaceAll('\n ', '\n'), |
84 }); | 88 }); |
85 } | 89 } |
OLD | NEW |