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 @HtmlImport(importPath) | |
Siggi Cherem (dart-lang)
2015/02/12 16:49:44
I'm surprised this works in the transformer withou
jakemac
2015/02/12 17:04:09
This works but will be injected at runtime since t
| |
5 // This one will throw a build time warning, but should still work dynamically. | |
6 @HtmlImport('bad_import.html') | |
7 library web_components.test.html_import_annotation; | |
8 | |
9 import 'dart:html'; | |
10 import 'package:initialize/initialize.dart' as init; | |
11 import 'package:unittest/html_config.dart'; | |
12 import 'package:unittest/unittest.dart'; | |
13 import 'package:web_components/html_import_annotation.dart'; | |
14 | |
15 const String importPath = 'my_import.html'; | |
16 | |
17 main() { | |
18 useHtmlConfiguration(); | |
19 | |
20 test('adds import to head', () { | |
21 return init.run().then((_) { | |
22 var good = document.head.querySelector('link[href="$importPath"]'); | |
23 expect(good.import.body.text, 'Hello world!\n'); | |
24 var bad = document.head.querySelector('link[href="bad_import.html"]'); | |
25 expect(bad.import, isNull); | |
26 }); | |
27 }); | |
28 } | |
OLD | NEW |