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

Side by Side Diff: pkg/polymer/test/mirror_loader_test.dart

Issue 225043004: Replace bootstrap logic with 'boot.js', use 'component/dart' mime-type and add (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:html'; 6 import 'dart:html';
7 7
8 import 'dart:mirrors';
9
8 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
9 import 'package:unittest/html_config.dart'; 11 import 'package:unittest/html_config.dart';
10 import 'package:polymer/polymer.dart'; 12 import 'package:path/path.dart' show url;
11 13
12 @CustomTag('x-a') 14 import 'package:polymer/src/mirror_loader.dart';
13 class XA extends PolymerElement { 15 import 'mirror_loader_1.dart' as m1;
14 final String x = "a"; 16 import 'mirror_loader_2.dart' as m2;
15 XA.created() : super.created(); 17 import 'mirror_loader_3.dart' as m3;
16 } 18 import 'mirror_loader_4.dart' as m4;
17
18 // The next classes are here as a regression test for darbug.com/17929. Our
19 // loader was incorrectly trying to retrieve the reflectiveType of these
20 // classes.
21 class Foo<T> {}
22
23 @CustomTag('x-b')
24 class XB<T> extends PolymerElement {
25 final String x = "a";
26 XB.created() : super.created();
27 }
28 19
29 main() { 20 main() {
30 useHtmlConfiguration(); 21 useHtmlConfiguration();
31 22
32 runZoned(() { 23 test('registered correctly', () {
33 initPolymer().run(() { 24 expect(_discover(#mirror_loader_test1).length, 1);
34 setUp(() => Polymer.onReady); 25 expect(_discover(#mirror_loader_test2).length, 1);
26 });
35 27
36 test('XA was registered correctly', () { 28 test('parameterized custom tags are not registered', () {
37 expect(querySelector('x-a').shadowRoot.nodes.first.text, 'a'); 29 runZoned(() {
38 }); 30 expect(_discover(#mirror_loader_test3).length, 0);
31 }, onError: (e) {
32 expect(e is UnsupportedError, isTrue);
33 expect('$e', contains(
34 'Custom element classes cannot have type-parameters: XB'));
35 });
36 });
39 37
40 test('XB was not registered', () { 38 test('registers correct types even when errors are found', () {
41 expect(querySelector('x-b').shadowRoot, null); 39 runZoned(() {
42 }); 40 expect(_discover(#mirror_loader_test4).length, 1);
41 }, onError: (e) {
42 expect(e is UnsupportedError, isTrue);
43 expect('$e', contains(
44 'Custom element classes cannot have type-parameters: XB'));
43 }); 45 });
44 }, onError: (e) {
45 expect(e is UnsupportedError, isTrue);
46 expect('$e', contains(
47 'Custom element classes cannot have type-parameters: XB'));
48 }); 46 });
49 } 47 }
48
49 final mirrors = currentMirrorSystem();
50 _discover(Symbol name) =>
51 discoverInitializers([mirrors.findLibrary(name).uri.toString()]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698