Index: test/build/html_import_annotation_inliner_test.dart |
diff --git a/test/build/html_import_annotation_inliner_test.dart b/test/build/html_import_annotation_inliner_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bee6668dc9751f8337c228a0e59059cdcb629949 |
--- /dev/null |
+++ b/test/build/html_import_annotation_inliner_test.dart |
@@ -0,0 +1,68 @@ |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+library web_components.test.build.html_import_annotation_inliner_test; |
+ |
+import 'common.dart'; |
+import 'package:web_components/build/html_import_annotation_inliner.dart'; |
+import 'package:unittest/compact_vm_config.dart'; |
+ |
+main() { |
+ useCompactVMConfiguration(); |
+ |
+ var transformer = new HtmlImportAnnotationInliner( |
+ 'web/index.bootstrap.dart', 'web/index.html'); |
+ |
+ testPhases('basic', [[transformer]], { |
+ 'foo|web/index.html': ''' |
+ <html><head></head><body> |
+ <script type="application/dart" src="index.bootstrap.dart"></script> |
+ </body></html> |
+ '''.replaceAll(' ', ''), |
+ 'foo|web/index.bootstrap.dart': ''' |
+ import 'package:initialize/src/static_loader.dart'; |
+ import 'package:initialize/src/initializer.dart'; |
+ import 'index.dart' as i0; |
+ import 'package:web_components/html_import_annotation.dart' as i1; |
+ import 'package:baz/baz.dart' as i2; |
+ |
+ main() { |
+ initializers.addAll([ |
+ new InitEntry(const i2.initMethod, i0.baz), |
+ new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifier(#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
|
+ new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifier(#foo, null, 'web/foo/foo.dart')), |
+ new InitEntry(const i1.HtmlImport('../foo.html'), const LibraryIdentifier(#foo, null, 'web/foo/foo.dart')), |
+ new InitEntry(const i1.HtmlImport('package:foo/foo.html'), const LibraryIdentifier(#foo, null, 'lib/foo.dart')), |
+ new InitEntry(const i1.HtmlImport('package:foo/foo/foo.html'), const LibraryIdentifier(#foo, null, 'lib/foo/foo.dart')), |
+ new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifier(#bar, 'bar', 'lib/bar.dart')), |
+ new InitEntry(const i1.HtmlImport('bar.html'), const LibraryIdentifier(#bar.Bar, 'bar', 'lib/bar/bar.dart')), |
+ new InitEntry(const i1.HtmlImport('package:bar/bar.html'), const LibraryIdentifier(#bar, 'bar', 'lib/bar.dart')), |
+ new InitEntry(const i1.HtmlImport('package:bar/bar/bar.html'), const LibraryIdentifier(#bar.Bar, 'bar', 'lib/bar/bar.dart')), |
+ ]); |
+ |
+ i0.main(); |
+ } |
+ ''', |
+ }, { |
+ 'foo|web/index.html': ''' |
+ <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
|
+ <script type="application/dart" src="index.bootstrap.dart"></script> |
+ |
+ </body></html>'''.replaceAll(' ', ''), |
+ 'foo|web/index.bootstrap.dart': ''' |
+ import 'package:initialize/src/static_loader.dart'; |
+ import 'package:initialize/src/initializer.dart'; |
+ import 'index.dart' as i0; |
+ import 'package:web_components/html_import_annotation.dart' as i1; |
+ import 'package:baz/baz.dart' as i2; |
+ |
+ main() { |
+ initializers.addAll([ |
+ new InitEntry(const i2.initMethod, i0.baz), |
+ ]); |
+ |
+ i0.main(); |
+ } |
+ ''' |
+ }, []); |
+} |