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