OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
5 library polymer.test.build.import_inliner_test; | 5 library polymer.test.build.import_inliner_test; |
6 | 6 |
7 import 'dart:convert' show JSON; | 7 import 'dart:convert' show JSON; |
8 import 'package:polymer/src/build/common.dart'; | 8 import 'package:polymer/src/build/common.dart'; |
9 import 'package:polymer/src/build/import_inliner.dart'; | 9 import 'package:polymer/src/build/import_inliner.dart'; |
10 import 'package:unittest/compact_vm_config.dart'; | 10 import 'package:unittest/compact_vm_config.dart'; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 '<script type="application/dart">/*1*/</script>' | 166 '<script type="application/dart">/*1*/</script>' |
167 '</head></html>', | 167 '</head></html>', |
168 'a|web/foo_02_test.html': | 168 'a|web/foo_02_test.html': |
169 '<!DOCTYPE html><html><head>' | 169 '<!DOCTYPE html><html><head>' |
170 '<script type="application/dart">/*2*/</script>' | 170 '<script type="application/dart">/*2*/</script>' |
171 '</head></html>', | 171 '</head></html>', |
172 'a|web/test_03.html': | 172 'a|web/test_03.html': |
173 '<!DOCTYPE html><html><head>' | 173 '<!DOCTYPE html><html><head>' |
174 '<script type="application/dart">/*3*/</script>' | 174 '<script type="application/dart">/*3*/</script>' |
175 '</head></html>', | 175 '</head></html>', |
176 'a|web/*test_%foo_04!.html': | 176 'a|web/test_fo*o_04!.html': |
177 '<!DOCTYPE html><html><head>' | 177 '<!DOCTYPE html><html><head>' |
178 '<script type="application/dart">/*4*/</script>' | 178 '<script type="application/dart">/*4*/</script>' |
179 '</head></html>', | 179 '</head></html>', |
180 'a|web/%05_test.html': | 180 'a|web/foo_05_test.html': |
181 '<!DOCTYPE html><html><head>' | 181 '<!DOCTYPE html><html><head>' |
182 '<script type="application/dart">/*5*/</script>' | 182 '<script type="application/dart">/*5*/</script>' |
183 '</head></html>', | 183 '</head></html>', |
184 }, { | 184 }, { |
185 'a|web/01_test.html.0.dart': | 185 'a|web/01_test.html.0.dart': |
186 'library a.web._01_test_html_0;\n/*1*/', // Appends an _ if i
t starts with a number. | 186 'library a.web._01_test_html_0;\n/*1*/', // Appends an _ if i
t starts with a number. |
187 'a|web/foo_02_test.html.0.dart': | 187 'a|web/foo_02_test.html.0.dart': |
188 'library a.web.foo_02_test_html_0;\n/*2*/', // Allows numbers in
the middle. | 188 'library a.web.foo_02_test_html_0;\n/*2*/', // Allows numbers in
the middle. |
189 'a|web/test_03.html.0.dart': | 189 'a|web/test_03.html.0.dart': |
190 'library a.web.test_03_html_0;\n/*3*/', // Allows numbers at
the end. | 190 'library a.web.test_03_html_0;\n/*3*/', // Allows numbers at
the end. |
191 'a|web/*test_%foo_04!.html.0.dart': | 191 'a|web/test_fo*o_04!.html.0.dart': |
192 'library a.web._test__foo_04__html_0;\n/*4*/', // Replaces invalid
characters with _. | 192 'library a.web.test_fo_o_04__html_0;\n/*4*/', // Replaces invalid c
haracters with _. |
193 'a|web/%05_test.html.0.dart': | 193 'a|web/foo_05_test.html.0.dart': |
194 'library a.web._05_test_html_0;\n/*5*/', // Replace invalid c
haracter followed by number. | 194 'library a.web.foo_05_test_html_0;\n/*5*/', // Replace invali
d character followed by number. |
195 }); | 195 }); |
196 | 196 |
197 testPhases('no transformation outside web/', phases, | 197 testPhases('no transformation outside web/', phases, |
198 { | 198 { |
199 'a|lib/test.html': | 199 'a|lib/test.html': |
200 '<!DOCTYPE html><html><head>' | 200 '<!DOCTYPE html><html><head>' |
201 '<link rel="import" href="test2.html">' | 201 '<link rel="import" href="test2.html">' |
202 '</head></html>', | 202 '</head></html>', |
203 'a|lib/test2.html': | 203 'a|lib/test2.html': |
204 '<!DOCTYPE html><html><head>' | 204 '<!DOCTYPE html><html><head>' |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 'a|web/foo/test.html': | 876 'a|web/foo/test.html': |
877 '<img src="baz/{{bar}}">' | 877 '<img src="baz/{{bar}}">' |
878 '<img src="./{{bar}}">', | 878 '<img src="./{{bar}}">', |
879 }, { | 879 }, { |
880 'a|web/test.html': | 880 'a|web/test.html': |
881 '<!DOCTYPE html><html><head></head><body>' | 881 '<!DOCTYPE html><html><head></head><body>' |
882 '<img src="foo/baz/{{bar}}">' | 882 '<img src="foo/baz/{{bar}}">' |
883 '<img src="foo/{{bar}}">' | 883 '<img src="foo/{{bar}}">' |
884 '</body></html>', | 884 '</body></html>', |
885 }); | 885 }); |
| 886 |
| 887 testPhases('arbitrary bindings can exist in paths', phases, { |
| 888 'a|web/test.html': |
| 889 '<!DOCTYPE html><html><head></head><body>' |
| 890 '<img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">' |
| 891 '<img src="./[[bar[2]]].jpg">' |
| 892 '</body></html>', |
| 893 }, { |
| 894 'a|web/test.html': |
| 895 '<!DOCTYPE html><html><head></head><body>' |
| 896 '<img src="{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">' |
| 897 '<img src="[[bar[2]]].jpg">' |
| 898 '</body></html>', |
| 899 }); |
| 900 |
| 901 testPhases('multiple bindings can exist in paths', phases, { |
| 902 'a|web/test.html': |
| 903 '<!DOCTYPE html><html><head></head><body>' |
| 904 '<img src="./{{bar[0]}}/{{baz[1]}}.{{extension}}">' |
| 905 '</body></html>', |
| 906 }, { |
| 907 'a|web/test.html': |
| 908 '<!DOCTYPE html><html><head></head><body>' |
| 909 '<img src="{{bar[0]}}/{{baz[1]}}.{{extension}}">' |
| 910 '</body></html>', |
| 911 }); |
886 } | 912 } |
887 | 913 |
888 void entryPointTests() { | 914 void entryPointTests() { |
889 testPhases('one level deep entry points normalize correctly', phases, { | 915 testPhases('one level deep entry points normalize correctly', phases, { |
890 'a|web/test/test.html': | 916 'a|web/test/test.html': |
891 '<!DOCTYPE html><html><head>' | 917 '<!DOCTYPE html><html><head>' |
892 '<link rel="import" href="../../packages/a/foo/foo.html">' | 918 '<link rel="import" href="../../packages/a/foo/foo.html">' |
893 '</head></html>', | 919 '</head></html>', |
894 'a|lib/foo/foo.html': | 920 'a|lib/foo/foo.html': |
895 '<script rel="import" href="../../../packages/b/bar/bar.js">' | 921 '<script rel="import" href="../../../packages/b/bar/bar.js">' |
(...skipping 30 matching lines...) Expand all Loading... |
926 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', | 952 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', |
927 'b|lib/bar/bar.js': | 953 'b|lib/bar/bar.js': |
928 'console.log("here");', | 954 'console.log("here");', |
929 }, { | 955 }, { |
930 'a|web/test/well/test.html': | 956 'a|web/test/well/test.html': |
931 '<!DOCTYPE html><html><head></head><body>' | 957 '<!DOCTYPE html><html><head></head><body>' |
932 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' | 958 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' |
933 '</body></html>', | 959 '</body></html>', |
934 }); | 960 }); |
935 } | 961 } |
OLD | NEW |