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

Side by Side Diff: third_party/pkg/angular/test/mock/test_bed_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 angular.mock.test_bed_spec;
2
3 import '../_specs.dart';
4
5 main() =>
6 describe('test bed', () {
7 TestBed _;
8 Compiler $compile;
9 Injector injector;
10 Scope $rootScope;
11
12 beforeEach(module((Module module) {
13 module..type(MyTestBedDirective);
14 return (TestBed tb) => _ = tb;
15 }));
16
17 it('should allow for a scope-based compile', () {
18
19 inject((Scope scope) {
20 Scope childScope = scope.$new();
21
22 var element = $('<div my-directive probe="i"></div>');
23 _.compile(element, scope: childScope);
24
25 Probe probe = _.rootScope.i;
26 var directiveInst = probe.directive(MyTestBedDirective);
27
28 childScope.$destroy();
29
30 expect(directiveInst.destroyed).toBe(true);
31 });
32 });
33
34 });
35
36 @NgDirective(selector: '[my-directive]')
37 class MyTestBedDirective {
38 bool destroyed = false;
39
40 MyTestBedDirective(Scope scope) {
41 scope.$on(r'$destroy', () {
42 destroyed = true;
43 });
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698