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

Side by Side Diff: third_party/pkg/angular/test/routing/routing_spec.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
(Empty)
1 library routing_spec;
2
3 import '../_specs.dart';
4 import 'package:angular/routing/module.dart';
5 import 'package:angular/mock/module.dart';
6
7 main() {
8 describe('routing', () {
9 TestBed _;
10 TestRouteInitializer initer;
11 Router router;
12
13 beforeEach(module((Module m) {
14 router = new Router(useFragment: false, windowImpl: new MockWindow());
15 m
16 ..install(new AngularMockModule())
17 ..type(RouteInitializer, implementedBy: TestRouteInitializer)
18 ..value(Router, router);
19 }));
20
21 beforeEach(inject((TestBed tb, RouteInitializer _initer) {
22 _ = tb;
23 initer = _initer;
24 }));
25
26
27 it('should call init of the RouteInitializer once', async(() {
28 expect(initer.calledInit).toEqual(0);
29
30 // Force the routing system to initialize.
31 _.compile('<ng-view></ng-view>');
32
33 expect(initer.calledInit).toEqual(1);
34 expect(initer.router).toBe(router);
35 }));
36
37 });
38 }
39
40 class TestRouteInitializer implements RouteInitializer {
41 int calledInit = 0;
42 Router router;
43
44 void init(Router router, ViewFactory view) {
45 calledInit++;
46 this.router = router;
47 }
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698