Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: pkg/polymer/test/build/import_inliner_test.dart

Issue 433913002: Strip bindings before calling Uri.parse (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: made new path building a bit more efficient Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 }); 891 });
892 892
893 testPhases('paths with a binding prefix are not normalized', phases, { 893 testPhases('paths with a binding prefix are not normalized', phases, {
894 'a|web/test.html': 894 'a|web/test.html':
895 '<!DOCTYPE html><html><head>' 895 '<!DOCTYPE html><html><head>'
896 '<link rel="import" href="foo/test.html">' 896 '<link rel="import" href="foo/test.html">'
897 '</head></html>', 897 '</head></html>',
898 'a|web/foo/test.html': 898 'a|web/foo/test.html':
899 '<img src="{{bar}}">' 899 '<img src="{{bar}}">'
900 '<img src="[[bar]]">', 900 '<img src="[[bar]]">',
901 }, { 901 }, {
902 'a|web/test.html': 902 'a|web/test.html':
903 '<!DOCTYPE html><html><head></head><body>' 903 '<!DOCTYPE html><html><head></head><body>'
904 '<img src="{{bar}}">' 904 '<img src="{{bar}}">'
905 '<img src="[[bar]]">' 905 '<img src="[[bar]]">'
906 '</body></html>', 906 '</body></html>',
907 'a|web/foo/test.html': 907 'a|web/foo/test.html':
908 '<img src="{{bar}}">' 908 '<img src="{{bar}}">'
909 '<img src="[[bar]]">', 909 '<img src="[[bar]]">',
910 }); 910 });
911 911
912 testPhases('relative paths followed by bindings are normalized', phases, { 912 testPhases('relative paths followed by bindings are normalized', phases, {
913 'a|web/test.html': 913 'a|web/test.html':
914 '<!DOCTYPE html><html><head>' 914 '<!DOCTYPE html><html><head>'
915 '<link rel="import" href="foo/test.html">' 915 '<link rel="import" href="foo/test.html">'
916 '</head></html>', 916 '</head></html>',
917 'a|web/foo/test.html': 917 'a|web/foo/test.html':
918 '<img src="baz/{{bar}}">' 918 '<img src="baz/{{bar}}">'
919 '<img src="./{{bar}}">', 919 '<img src="./{{bar}}">',
920 }, { 920 }, {
(...skipping 28 matching lines...) Expand all
949 '</body></html>', 949 '</body></html>',
950 }, {}, [ 950 }, {}, [
951 'warning: When using bindings with the "src" attribute you may ' 951 'warning: When using bindings with the "src" attribute you may '
952 'experience errors in certain browsers. Please use the "_src" ' 952 'experience errors in certain browsers. Please use the "_src" '
953 'attribute instead. For more information, see http://goo.gl/5av8cU ' 953 'attribute instead. For more information, see http://goo.gl/5av8cU '
954 '(web/test.html 0 40)', 954 '(web/test.html 0 40)',
955 'warning: The "_href" attribute is only supported when using bindings. ' 955 'warning: The "_href" attribute is only supported when using bindings. '
956 'Please change to the "href" attribute. (web/test.html 0 63)', 956 'Please change to the "href" attribute. (web/test.html 0 63)',
957 957
958 ]); 958 ]);
959
960 testPhases('arbitrary bindings can exist in paths', phases, {
961 'a|web/test.html':
962 '<!DOCTYPE html><html><head></head><body>'
963 '<img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">'
964 '<img src="./[[bar[2]]].jpg">'
965 '</body></html>',
966 }, {
967 'a|web/test.html':
968 '<!DOCTYPE html><html><head></head><body>'
969 '<img src="{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">'
970 '<img src="[[bar[2]]].jpg">'
971 '</body></html>',
972 });
973
974 testPhases('multiple bindings can exist in paths', phases, {
975 'a|web/test.html':
976 '<!DOCTYPE html><html><head></head><body>'
977 '<img src="./{{bar[0]}}/{{baz[1]}}.{{extension}}">'
978 '</body></html>',
979 }, {
980 'a|web/test.html':
981 '<!DOCTYPE html><html><head></head><body>'
982 '<img src="{{bar[0]}}/{{baz[1]}}.{{extension}}">'
983 '</body></html>',
984 });
959 } 985 }
960 986
961 void entryPointTests() { 987 void entryPointTests() {
962 testPhases('one level deep entry points normalize correctly', phases, { 988 testPhases('one level deep entry points normalize correctly', phases, {
963 'a|web/test/test.html': 989 'a|web/test/test.html':
964 '<!DOCTYPE html><html><head>' 990 '<!DOCTYPE html><html><head>'
965 '<link rel="import" href="../../packages/a/foo/foo.html">' 991 '<link rel="import" href="../../packages/a/foo/foo.html">'
966 '</head></html>', 992 '</head></html>',
967 'a|lib/foo/foo.html': 993 'a|lib/foo/foo.html':
968 '<script rel="import" href="../../../packages/b/bar/bar.js">' 994 '<script rel="import" href="../../../packages/b/bar/bar.js">'
(...skipping 30 matching lines...) Expand all
999 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', 1025 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>',
1000 'b|lib/bar/bar.js': 1026 'b|lib/bar/bar.js':
1001 'console.log("here");', 1027 'console.log("here");',
1002 }, { 1028 }, {
1003 'a|web/test/well/test.html': 1029 'a|web/test/well/test.html':
1004 '<!DOCTYPE html><html><head></head><body>' 1030 '<!DOCTYPE html><html><head></head><body>'
1005 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' 1031 '<script rel="import" href="../../packages/b/bar/bar.js"></script>'
1006 '</body></html>', 1032 '</body></html>',
1007 }); 1033 });
1008 } 1034 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698