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

Side by Side Diff: third_party/pkg/angular/lib/mock/probe.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 part of angular.mock;
2
3 /*
4 * Use Probe directive to capture the Scope, Injector and Element from any DOM
5 * location into root-scope. This is useful for testing to get a hold of
6 * any directive.
7 *
8 * <div some-directive probe="myProbe">..</div>
9 *
10 * rootScope.myProbe.directive(SomeAttrDirective);
11 */
12 @NgDirective(selector: '[probe]')
13 class Probe implements NgDetachAware {
14 final Scope scope;
15 final Injector injector;
16 final Element element;
17 final NodeAttrs _attrs;
18
19 Probe(this.scope, this.injector, this.element, this._attrs) {
20 scope.$root[_attrs['probe']] = this;
21 }
22
23 detach() => scope.$root[_attrs['probe']] = null;
24
25 /**
26 * Retrieve a Directive at the current element.
27 */
28 directive(Type type) => injector.get(type);
29 }
30
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698