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'; | 7 import 'dart:convert'; |
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 testLogOutput( | 674 testLogOutput( |
675 (options) => new ImportInliner(options), | 675 (options) => new ImportInliner(options), |
676 "missing html imports throw errors", { | 676 "missing html imports throw errors", { |
677 'a|web/test.html': | 677 'a|web/test.html': |
678 '<!DOCTYPE html><html><head>' | 678 '<!DOCTYPE html><html><head>' |
679 '<link rel="import" href="foo.html">' | 679 '<link rel="import" href="foo.html">' |
680 '</head></html>', | 680 '</head></html>', |
681 }, { | 681 }, { |
682 'a|web/test.html._buildLogs.1': | 682 'a|web/test.html._buildLogs.1': |
683 '[{' | 683 '{"polymer#25":[{' |
684 '"level":"Error",' | 684 '"level":"Error",' |
685 '"message":"${const HtmlEscape().convert( | 685 '"message":{' |
686 'Failed to inline html import: ' | 686 '"id":"polymer#25",' |
687 'Could not find asset a|web/foo.html.')}",' | 687 '"snippet":"Failed to inline HTML import: ' |
688 '"assetId":{"package":"a","path":"web/foo.html"},' | 688 'Could not find asset a|web/foo.html."' |
| 689 '},' |
689 '"span":{' | 690 '"span":{' |
690 '"location":"web/test.html:1:28",' | 691 '"start":{' |
691 '"text":"${const HtmlEscape().convert( | 692 '"url":"web/test.html",' |
692 '<link rel="import" href="foo.html">')}"' | 693 '"offset":27,' |
693 '}' | 694 '"line":0,' |
694 '}]', | 695 '"column":27' |
| 696 '},' |
| 697 '"end":{' |
| 698 '"url":"web/test.html",' |
| 699 '"offset":62,' |
| 700 '"line":0,' |
| 701 '"column":62' |
| 702 '},' |
| 703 '"text":"<link rel=\\"import\\" href=\\"foo.html\\">"' |
| 704 '}' |
| 705 '}]}', |
695 }, [ | 706 }, [ |
696 'error: Failed to inline html import: ' | 707 'error: Failed to inline HTML import: ' |
697 'Could not find asset a|web/foo.html. (web/test.html 0 27)', | 708 'Could not find asset a|web/foo.html. (web/test.html 0 27)', |
698 ]); | 709 ]); |
699 } | 710 } |
700 | 711 |
701 void stylesheetTests() { | 712 void stylesheetTests() { |
702 | 713 |
703 testPhases('empty stylesheet', phases, { | 714 testPhases('empty stylesheet', phases, { |
704 'a|web/test.html': | 715 'a|web/test.html': |
705 '<!DOCTYPE html><html><head>' | 716 '<!DOCTYPE html><html><head>' |
706 '<link rel="stylesheet" href="">' // empty href | 717 '<link rel="stylesheet" href="">' // empty href |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 (options) => new ImportInliner(options), | 1026 (options) => new ImportInliner(options), |
1016 'warnings are given about _* attributes', { | 1027 'warnings are given about _* attributes', { |
1017 'a|web/test.html': | 1028 'a|web/test.html': |
1018 '<!DOCTYPE html><html><head></head><body>' | 1029 '<!DOCTYPE html><html><head></head><body>' |
1019 '<img src="foo/{{bar}}">' | 1030 '<img src="foo/{{bar}}">' |
1020 '<a _href="foo/bar">test</a>' | 1031 '<a _href="foo/bar">test</a>' |
1021 '</body></html>', | 1032 '</body></html>', |
1022 }, {}, [ | 1033 }, {}, [ |
1023 'warning: When using bindings with the "src" attribute you may ' | 1034 'warning: When using bindings with the "src" attribute you may ' |
1024 'experience errors in certain browsers. Please use the "_src" ' | 1035 'experience errors in certain browsers. Please use the "_src" ' |
1025 'attribute instead. For more information, see ' | 1036 'attribute instead. (web/test.html 0 40)', |
1026 'http://goo.gl/5av8cU (web/test.html 0 40)', | |
1027 'warning: The "_href" attribute is only supported when using ' | 1037 'warning: The "_href" attribute is only supported when using ' |
1028 'bindings. Please change to the "href" attribute. ' | 1038 'bindings. Please change to the "href" attribute. ' |
1029 '(web/test.html 0 63)', | 1039 '(web/test.html 0 63)', |
1030 | 1040 |
1031 ]); | 1041 ]); |
1032 | 1042 |
1033 testPhases('arbitrary bindings can exist in paths', phases, { | 1043 testPhases('arbitrary bindings can exist in paths', phases, { |
1034 'a|web/test.html': | 1044 'a|web/test.html': |
1035 '<!DOCTYPE html><html><head></head><body>' | 1045 '<!DOCTYPE html><html><head></head><body>' |
1036 '<img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">' | 1046 '<img src="./{{(bar[2] + baz[\'foo\']) * 14 / foobar() - 0.5}}.jpg">' |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', | 1108 '<script rel="import" href="../../../packages/b/bar/bar.js"></script>', |
1099 'b|lib/bar/bar.js': | 1109 'b|lib/bar/bar.js': |
1100 'console.log("here");', | 1110 'console.log("here");', |
1101 }, { | 1111 }, { |
1102 'a|web/test/well/test.html': | 1112 'a|web/test/well/test.html': |
1103 '<!DOCTYPE html><html><head></head><body>' | 1113 '<!DOCTYPE html><html><head></head><body>' |
1104 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' | 1114 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' |
1105 '</body></html>', | 1115 '</body></html>', |
1106 }); | 1116 }); |
1107 } | 1117 } |
OLD | NEW |