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.code_extractor_test; |
| 6 |
| 7 import 'package:polymer/src/transform/code_extractor.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 InlineCodeExtractor()]], { |
| 16 'a|test.html': '<!DOCTYPE html><html></html>', |
| 17 }, { |
| 18 'a|test.html': '<!DOCTYPE html><html></html>', |
| 19 }); |
| 20 |
| 21 testPhases('single script', [[new InlineCodeExtractor()]], { |
| 22 'a|test.html': |
| 23 '<!DOCTYPE html><html><head>' |
| 24 '<script type="application/dart">main() { }</script>', |
| 25 }, { |
| 26 'a|test.html': |
| 27 '<!DOCTYPE html><html><head>' |
| 28 '<script type="application/dart" src="test.html.0.dart"></script>' |
| 29 '</head><body></body></html>', |
| 30 |
| 31 'a|test.html.0.dart': |
| 32 'main() { }', |
| 33 }); |
| 34 |
| 35 testPhases('multiple scripts', [[new InlineCodeExtractor()]], { |
| 36 'a|test.html': |
| 37 '<!DOCTYPE html><html><head>' |
| 38 '<script type="application/dart">main1() { }</script>' |
| 39 '<script type="application/dart">main2() { }</script>', |
| 40 }, { |
| 41 'a|test.html': |
| 42 '<!DOCTYPE html><html><head>' |
| 43 '<script type="application/dart" src="test.html.0.dart"></script>' |
| 44 '<script type="application/dart" src="test.html.1.dart"></script>' |
| 45 '</head><body></body></html>', |
| 46 |
| 47 'a|test.html.0.dart': |
| 48 'main1() { }', |
| 49 |
| 50 'a|test.html.1.dart': |
| 51 'main2() { }', |
| 52 }); |
| 53 |
| 54 testPhases('multiple deeper scripts', [[new InlineCodeExtractor()]], { |
| 55 'a|test.html': |
| 56 '<!DOCTYPE html><html><head>' |
| 57 '<script type="application/dart">main1() { }</script>' |
| 58 '</head><body><div>' |
| 59 '<script type="application/dart">main2() { }</script>' |
| 60 '</div><div><div>' |
| 61 '<script type="application/dart">main3() { }</script>' |
| 62 '</div></div>' |
| 63 }, { |
| 64 'a|test.html': |
| 65 '<!DOCTYPE html><html><head>' |
| 66 '<script type="application/dart" src="test.html.0.dart"></script>' |
| 67 '</head><body><div>' |
| 68 '<script type="application/dart" src="test.html.1.dart"></script>' |
| 69 '</div><div><div>' |
| 70 '<script type="application/dart" src="test.html.2.dart"></script>' |
| 71 '</div></div></body></html>', |
| 72 |
| 73 'a|test.html.0.dart': |
| 74 'main1() { }', |
| 75 |
| 76 'a|test.html.1.dart': |
| 77 'main2() { }', |
| 78 |
| 79 'a|test.html.2.dart': |
| 80 'main3() { }', |
| 81 }); |
| 82 } |
OLD | NEW |