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

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: Created 5 years, 11 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 'common.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><head></head><body>
19 <script type="application/dart" src="index.bootstrap.dart"></script>
20 </body></html>
21 '''.replaceAll(' ', ''),
22 'foo|web/index.bootstrap.dart': '''
23 import 'package:initialize/src/static_loader.dart';
24 import 'package:initialize/src/initializer.dart';
25 import 'index.dart' as i0;
26 import 'package:web_components/html_import_annotation.dart' as i1;
27 import 'package:baz/baz.dart' as i2;
28
29 main() {
30 initializers.addAll([
31 new InitEntry(const i2.initMethod, i0.baz),
32 new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifi er(#foo, null, 'web/foo.dart')),
Jennifer Messerly 2015/01/29 21:32:38 run dartfmt on this file?
jakemac 2015/02/02 20:55:57 Did this on the whole project, these kind of have
33 new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifi er(#foo, null, 'web/foo/foo.dart')),
34 new InitEntry(const i1.HtmlImport('../foo.html'), const LibraryIdent ifier(#foo, null, 'web/foo/foo.dart')),
35 new InitEntry(const i1.HtmlImport('package:foo/foo.html'), const Lib raryIdentifier(#foo, null, 'lib/foo.dart')),
36 new InitEntry(const i1.HtmlImport('package:foo/foo/foo.html'), const LibraryIdentifier(#foo, null, 'lib/foo/foo.dart')),
37 new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifi er(#bar, 'bar', 'lib/bar.dart')),
38 new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifi er(#bar.Bar, 'bar', 'lib/bar/bar.dart')),
39 new InitEntry(const i1.HtmlImport('package:bar/bar.html'), const Lib raryIdentifier(#bar, 'bar', 'lib/bar.dart')),
40 new InitEntry(const i1.HtmlImport('package:bar/bar/bar.html'), const LibraryIdentifier(#bar.Bar, 'bar', 'lib/bar/bar.dart')),
41 ]);
42
43 i0.main();
44 }
45 ''',
46 }, {
47 'foo|web/index.html': '''
48 <html><head><link rel="import" href="foo.html"><link rel="import" href=" foo/foo.html"><link rel="import" href="packages/foo/foo.html"><link rel="import" href="packages/foo/foo/foo.html"><link rel="import" href="packages/bar/bar.html "><link rel="import" href="packages/bar/bar/bar.html"></head><body>
Jennifer Messerly 2015/01/29 21:32:38 long line in string
jakemac 2015/02/02 20:55:57 Unfortunately this is kind of necessary, it reflec
49 <script type="application/dart" src="index.bootstrap.dart"></script>
50
51 </body></html>'''.replaceAll(' ', ''),
52 'foo|web/index.bootstrap.dart': '''
53 import 'package:initialize/src/static_loader.dart';
54 import 'package:initialize/src/initializer.dart';
55 import 'index.dart' as i0;
56 import 'package:web_components/html_import_annotation.dart' as i1;
57 import 'package:baz/baz.dart' as i2;
58
59 main() {
60 initializers.addAll([
61 new InitEntry(const i2.initMethod, i0.baz),
62 ]);
63
64 i0.main();
65 }
66 '''
67 }, []);
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698