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

Side by Side Diff: test/build/html_import_annotation_inliner_test.dart

Issue 882823003: Adds @HtmlImport with both dynamic and transformer based implementations. Still need an HtmlInliner… (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: assign logger Created 5 years, 10 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
OLDNEW
(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.html_import_annotation_inliner_test;
5
6 import 'package:code_transformers/tests.dart';
7 import 'package:web_components/build/html_import_annotation_inliner.dart';
8 import 'package:unittest/compact_vm_config.dart';
9
10 main() {
11 useCompactVMConfiguration();
12
13 var transformer = new HtmlImportAnnotationInliner(
14 'web/index.bootstrap.dart', 'web/index.html');
15
16 testPhases('basic', [[transformer]], {
17 'foo|web/index.html': '''
18 <html>
19 <head></head>
20 <body>
21 <script type="application/dart" src="index.bootstrap.dart"></script>
22 </body>
23 </html>
24 ''',
25 'foo|web/index.bootstrap.dart': '''
26 import 'package:initialize/src/static_loader.dart';
27 import 'package:initialize/src/initializer.dart';
28 import 'index.dart' as i0;
29 import 'package:web_components/html_import_annotation.dart' as i1;
30 import 'package:baz/baz.dart' as i2;
31
32 main() {
33 initializers.addAll([
34 new InitEntry(i2.initMethod, i0.baz),
35 new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifi er(#foo, null, 'web/foo.dart')),
36 new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifi er(#foo, null, 'web/foo/foo.dart')),
37 new InitEntry(const i1.HtmlImport('../foo.html'), const LibraryIdent ifier(#foo, null, 'web/foo/foo.dart')),
38 new InitEntry(const i1.HtmlImport('package:foo/foo.html'), const Lib raryIdentifier(#foo, null, 'lib/foo.dart')),
39 new InitEntry(const i1.HtmlImport('package:foo/foo/foo.html'), const LibraryIdentifier(#foo, null, 'lib/foo/foo.dart')),
40 new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifi er(#bar, 'bar', 'lib/bar.dart')),
41 new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifi er(#bar.Bar, 'bar', 'lib/bar/bar.dart')),
42 new InitEntry(const i1.HtmlImport('package:bar/bar.html'), const Lib raryIdentifier(#bar, 'bar', 'lib/bar.dart')),
43 new InitEntry(const i1.HtmlImport('package:bar/bar/bar.html'), const LibraryIdentifier(#bar.Bar, 'bar', 'lib/bar/bar.dart')),
44 ]);
45
46 i0.main();
47 }
48 ''',
49 }, {
50 'foo|web/index.html': '''
51 <html>
52 <head>
53 <link rel="import" href="foo.html">
54 <link rel="import" href="foo/foo.html">
55 <link rel="import" href="packages/foo/foo.html">
56 <link rel="import" href="packages/foo/foo/foo.html">
57 <link rel="import" href="packages/bar/bar.html">
58 <link rel="import" href="packages/bar/bar/bar.html">
59 </head>
60 <body>
61 <script type="application/dart" src="index.bootstrap.dart"></script>
62 </body>
63 </html>''',
64 'foo|web/index.bootstrap.dart': '''
65 import 'package:initialize/src/static_loader.dart';
66 import 'package:initialize/src/initializer.dart';
67 import 'index.dart' as i0;
68 import 'package:web_components/html_import_annotation.dart' as i1;
69 import 'package:baz/baz.dart' as i2;
70
71 main() {
72 initializers.addAll([
73 new InitEntry(i2.initMethod, i0.baz),
74 ]);
75
76 i0.main();
77 }
78 '''
79 }, [], StringFormatter.noNewlinesOrSurroundingWhitespace);
80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698