OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 library web_components.test.build.import_inliner_test; | 4 library web_components.test.build.import_inliner_test; |
5 | 5 |
6 import 'package:code_transformers/tests.dart'; | 6 import 'package:code_transformers/tests.dart'; |
7 import 'package:web_components/build/import_inliner.dart'; | 7 import 'package:web_components/build/import_inliner.dart'; |
8 import 'package:web_components/build/messages.dart'; | 8 import 'package:web_components/build/messages.dart'; |
9 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 | 11 |
12 var transformer = new ImportInlinerTransformer(); | 12 var transformer = new ImportInlinerTransformer(null, ['{{', '[[']); |
13 var phases = [[transformer]]; | 13 var phases = [[transformer]]; |
14 | 14 |
15 main() { | 15 main() { |
16 useCompactVMConfiguration(); | 16 useCompactVMConfiguration(); |
17 | 17 |
18 group('rel=import', importTests); | 18 group('rel=import', importTests); |
19 group('url attributes', urlAttributeTests); | 19 group('url attributes', urlAttributeTests); |
20 group('deep entrypoints', entryPointTests); | 20 group('deep entrypoints', entryPointTests); |
21 } | 21 } |
22 | 22 |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 }, { | 703 }, { |
704 'a|web/test.html': ''' | 704 'a|web/test.html': ''' |
705 <!DOCTYPE html><html><head></head><body> | 705 <!DOCTYPE html><html><head></head><body> |
706 <div hidden=""> | 706 <div hidden=""> |
707 <img _src="foo/{{bar}}"> | 707 <img _src="foo/{{bar}}"> |
708 <a _href="foo/{{bar}}">test</a> | 708 <a _href="foo/{{bar}}">test</a> |
709 </div> | 709 </div> |
710 </body></html>''', | 710 </body></html>''', |
711 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); | 711 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
712 | 712 |
| 713 testPhases('paths starting with a binding are treated as absolute', phases, { |
| 714 'a|web/test.html': ''' |
| 715 <!DOCTYPE html><html><head> |
| 716 <link rel="import" href="packages/a/foo.html"> |
| 717 </head></html>''', |
| 718 'a|lib/foo.html': ''' |
| 719 <img _src="{{bar}}"> |
| 720 <img _src="[[bar]]">''', |
| 721 }, { |
| 722 'a|web/test.html': ''' |
| 723 <!DOCTYPE html><html><head></head><body> |
| 724 <div hidden=""> |
| 725 <img _src="{{bar}}"> |
| 726 <img _src="[[bar]]"> |
| 727 </div> |
| 728 </body></html>''', |
| 729 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
| 730 |
713 testPhases('arbitrary bindings can exist in paths', phases, { | 731 testPhases('arbitrary bindings can exist in paths', phases, { |
714 'a|web/test.html': ''' | 732 'a|web/test.html': ''' |
715 <!DOCTYPE html><html><head></head><body> | 733 <!DOCTYPE html><html><head></head><body> |
716 <img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg"> | 734 <img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg"> |
717 <img src="./[[bar[2]]].jpg"> | 735 <img src="./[[bar[2]]].jpg"> |
718 </body></html>''', | 736 </body></html>''', |
719 }, { | 737 }, { |
720 'a|web/test.html': ''' | 738 'a|web/test.html': ''' |
721 <!DOCTYPE html><html><head></head><body> | 739 <!DOCTYPE html><html><head></head><body> |
722 <img src="{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg"> | 740 <img src="{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg"> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 console.log("here");''', | 823 console.log("here");''', |
806 }, { | 824 }, { |
807 'a|web/test/well/test.html': ''' | 825 'a|web/test/well/test.html': ''' |
808 <!DOCTYPE html><html><head></head><body> | 826 <!DOCTYPE html><html><head></head><body> |
809 <div hidden=""> | 827 <div hidden=""> |
810 <script rel="import" href="../../packages/b/bar/bar.js"></script> | 828 <script rel="import" href="../../packages/b/bar/bar.js"></script> |
811 </div> | 829 </div> |
812 </body></html>''', | 830 </body></html>''', |
813 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); | 831 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace); |
814 } | 832 } |
OLD | NEW |