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

Side by Side Diff: test/html_import_annotation_test.dart

Issue 1026153002: add initWebComponents (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: code review updates Created 5 years, 9 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
« no previous file with comments | « test/deps/c.html ('k') | test/init_web_components_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 @HtmlImport(importPath) 4 @HtmlImport(importPath)
5 // This one will throw a build time warning, but should still work dynamically. 5 // This one will throw a build time warning, but should still work dynamically.
6 @HtmlImport('bad_import.html') 6 @HtmlImport('bad_import.html')
7 library web_components.test.html_import_annotation; 7 library web_components.test.html_import_annotation;
8 8
9 import 'dart:html'; 9 import 'dart:html';
10 import 'package:initialize/initialize.dart' as init;
11 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
12 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
13 import 'package:web_components/html_import_annotation.dart'; 12 import 'package:web_components/web_components.dart';
14 import 'foo/bar.dart'; 13 import 'foo/bar.dart';
15 14
16 const String importPath = 'my_import.html'; 15 const String importPath = 'my_import.html';
17 16
18 main() { 17 main() {
19 useHtmlConfiguration(); 18 useHtmlConfiguration();
20 19
21 test('adds import to head', () { 20 test('adds import to head', () {
22 return init.run().then((_) { 21 return initWebComponents().then((_) {
23 var my_import = document.head.querySelector('link[href="$importPath"]'); 22 var my_import = document.head.querySelector('link[href="$importPath"]');
24 expect(my_import, isNotNull); 23 expect(my_import, isNotNull);
25 expect(my_import.import.body.text, 'Hello world!\n'); 24 expect(my_import.import.body.text, 'Hello world!\n');
26 25
27 var bar = document.head.querySelector('link[href="foo/bar.html"]'); 26 var bar = document.head.querySelector('link[href="foo/bar.html"]');
28 expect(bar, isNotNull); 27 expect(bar, isNotNull);
29 expect(bar.import.body.text, 'bar\n'); 28 expect(bar.import.body.text, 'bar\n');
30 29
31 var bad = document.head.querySelector('link[href="bad_import.html"]'); 30 var bad = document.head.querySelector('link[href="bad_import.html"]');
32 expect(bad.import, isNull); 31 expect(bad.import, isNull);
33 }); 32 });
34 }); 33 });
35 } 34 }
OLDNEW
« no previous file with comments | « test/deps/c.html ('k') | test/init_web_components_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698