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

Side by Side Diff: third_party/pkg/angular/test/core/registry_spec.dart

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (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 library registry_spec; 1 library registry_spec;
2 2
3 import '../_specs.dart'; 3 import '../_specs.dart';
4 import 'package:angular/application_factory.dart';
5 4
6 main() { 5 main() => describe('RegistryMap', () {
7 describe('RegistryMap', () { 6 it('should allow for multiple registry keys to be added', () {
8 it('should allow for multiple registry keys to be added', () { 7 var module = new Module()
9 var module = new Module() 8 ..type(MyMap)
10 ..type(MyMap) 9 ..type(MetadataExtractor)
11 ..type(A1) 10 ..type(A1)
12 ..type(A2); 11 ..type(A2);
13 12
14 var injector = applicationFactory().addModule(module).createInjector(); 13 var injector = new DynamicInjector(modules: [module]);
15 expect(() { 14 expect(() {
16 injector.get(MyMap); 15 injector.get(MyMap);
17 }).not.toThrow(); 16 }).not.toThrow();
18 }); 17 });
19 18
20 it('should iterate over all types', () { 19 it('should iterate over all types', () {
21 var module = new Module() 20 var module = new Module()
22 ..type(MyMap) 21 ..type(MyMap)
23 ..type(A1); 22 ..type(MetadataExtractor)
23 ..type(A1);
24 24
25 var injector = applicationFactory().addModule(module).createInjector(); 25 var injector = new DynamicInjector(modules: [module]);
26 var keys = []; 26 var keys = [];
27 var types = []; 27 var types = [];
28 var map = injector.get(MyMap); 28 var map = injector.get(MyMap);
29 map.forEach((k, t) { keys.add(k); types.add(t); }); 29 map.forEach((k, t) { keys.add(k); types.add(t); });
30 expect(keys).toEqual([new MyAnnotation('A'), new MyAnnotation('B')]); 30 expect(keys).toEqual([new MyAnnotation('A'), new MyAnnotation('B')]);
31 expect(types).toEqual([A1, A1]); 31 expect(types).toEqual([A1, A1]);
32 }); 32 });
33 33
34 it('should safely ignore typedefs', () { 34 it('should safely ignore typedefs', () {
35 var module = new Module() 35 var module = new Module()
36 ..type(MyMap) 36 ..type(MyMap)
37 ..value(MyTypedef, (String _) => null); 37 ..type(MetadataExtractor)
38 ..value(MyTypedef, (String _) => null);
38 39
39 var injector = applicationFactory().addModule(module).createInjector(); 40 var injector = new DynamicInjector(modules: [module]);
40 expect(() => injector.get(MyMap), isNot(throws)); 41 expect(() => injector.get(MyMap), isNot(throws));
41 });
42 }); 42 });
43 } 43 });
44 44
45 typedef void MyTypedef(String arg); 45 typedef void MyTypedef(String arg);
46 46
47 class MyMap extends AnnotationMap<MyAnnotation> { 47 class MyMap extends AnnotationMap<MyAnnotation> {
48 MyMap(Injector injector, MetadataExtractor metadataExtractor) 48 MyMap(Injector injector, MetadataExtractor metadataExtractor)
49 : super(injector, metadataExtractor); 49 : super(injector, metadataExtractor);
50 } 50 }
51 51
52 52
53 class MyAnnotation { 53 class MyAnnotation {
54 final String name; 54 final String name;
55 55
56 const MyAnnotation(String this.name); 56 const MyAnnotation(String this.name);
57 57
58 toString() => name; 58 toString() => name;
59 get hashCode => name.hashCode; 59 get hashCode => name.hashCode;
60 operator==(other) => this.name == other.name; 60 operator==(other) => this.name == other.name;
61 } 61 }
62 62
63 @MyAnnotation('A') @MyAnnotation('B') class A1 {} 63 @MyAnnotation('A') @MyAnnotation('B') class A1 {}
64 @MyAnnotation('A') class A2 {} 64 @MyAnnotation('A') class A2 {}
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/core/parser/static_parser_spec.dart ('k') | third_party/pkg/angular/test/core/scope_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698