OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 library web_components.test.build.test_compatibility_test; |
| 5 |
| 6 import 'package:code_transformers/tests.dart'; |
| 7 import 'package:web_components/build/test_compatibility.dart'; |
| 8 import 'package:unittest/compact_vm_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; |
| 10 |
| 11 var start = new RewriteXDartTestToScript(null); |
| 12 var end = new RewriteScriptToXDartTest(null); |
| 13 |
| 14 main() { |
| 15 useCompactVMConfiguration(); |
| 16 |
| 17 testPhases('can rewrite x-dart-test link tags to script tags', [[start]], { |
| 18 'a|test/index.html': ''' |
| 19 <!DOCTYPE html> |
| 20 <html> |
| 21 <head> |
| 22 <link rel="x-dart-test" href="foo.dart"> |
| 23 </head> |
| 24 <body></body> |
| 25 </html>''', |
| 26 }, { |
| 27 'a|test/index.html': ''' |
| 28 <!DOCTYPE html> |
| 29 <html> |
| 30 <head> |
| 31 <script type="application/dart" src="foo.dart" $testAttribute=""> |
| 32 </script> |
| 33 </head> |
| 34 <body></body> |
| 35 </html>''', |
| 36 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 37 |
| 38 |
| 39 testPhases('can rewrite script tags to x-dart-test link tags', [[end]], { |
| 40 'a|test/index.html': ''' |
| 41 <!DOCTYPE html> |
| 42 <html> |
| 43 <head> |
| 44 <script type="application/dart" src="foo.dart" $testAttribute=""> |
| 45 </script> |
| 46 </head> |
| 47 <body></body> |
| 48 </html>''', |
| 49 }, { |
| 50 'a|test/index.html': ''' |
| 51 <!DOCTYPE html> |
| 52 <html> |
| 53 <head> |
| 54 <link rel="x-dart-test" href="foo.dart"> |
| 55 </head> |
| 56 <body></body> |
| 57 </html>''', |
| 58 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 59 |
| 60 |
| 61 testPhases('restores original application at the end', [[start], [end]], { |
| 62 'a|test/index.html': ''' |
| 63 <!DOCTYPE html> |
| 64 <html> |
| 65 <head> |
| 66 <link rel="x-dart-test" href="foo.dart"> |
| 67 </head> |
| 68 <body></body> |
| 69 </html>''', |
| 70 }, { |
| 71 'a|test/index.html': ''' |
| 72 <!DOCTYPE html> |
| 73 <html> |
| 74 <head> |
| 75 <link rel="x-dart-test" href="foo.dart"> |
| 76 </head> |
| 77 <body></body> |
| 78 </html>''', |
| 79 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 80 } |
OLD | NEW |