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 testPhases('can rewrite script tags to x-dart-test link tags', [[end]], { |
| 39 'a|test/index.html': ''' |
| 40 <!DOCTYPE html> |
| 41 <html> |
| 42 <head> |
| 43 <script type="application/dart" src="foo.dart" $testAttribute=""> |
| 44 </script> |
| 45 </head> |
| 46 <body></body> |
| 47 </html>''', |
| 48 }, { |
| 49 'a|test/index.html': ''' |
| 50 <!DOCTYPE html> |
| 51 <html> |
| 52 <head> |
| 53 <link rel="x-dart-test" href="foo.dart"> |
| 54 </head> |
| 55 <body></body> |
| 56 </html>''', |
| 57 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 58 |
| 59 testPhases('restores original application at the end', [[start], [end]], { |
| 60 'a|test/index.html': ''' |
| 61 <!DOCTYPE html> |
| 62 <html> |
| 63 <head> |
| 64 <link rel="x-dart-test" href="foo.dart"> |
| 65 </head> |
| 66 <body></body> |
| 67 </html>''', |
| 68 }, { |
| 69 'a|test/index.html': ''' |
| 70 <!DOCTYPE html> |
| 71 <html> |
| 72 <head> |
| 73 <link rel="x-dart-test" href="foo.dart"> |
| 74 </head> |
| 75 <body></body> |
| 76 </html>''', |
| 77 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 78 } |
OLD | NEW |