OLD | NEW |
(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><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(i2.initMethod, i0.baz), |
| 32 new InitEntry(const i1.HtmlImport('foo.html'), const LibraryIdentifi
er(#foo, null, 'web/foo.dart')), |
| 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> |
| 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(i2.initMethod, i0.baz), |
| 62 ]); |
| 63 |
| 64 i0.main(); |
| 65 } |
| 66 ''' |
| 67 }, []); |
| 68 } |
OLD | NEW |