| Index: third_party/pkg/angular/lib/mock/probe.dart
|
| diff --git a/third_party/pkg/angular/lib/mock/probe.dart b/third_party/pkg/angular/lib/mock/probe.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b146bf63d5c9d5e72129974395727b59a8278b8b
|
| --- /dev/null
|
| +++ b/third_party/pkg/angular/lib/mock/probe.dart
|
| @@ -0,0 +1,30 @@
|
| +part of angular.mock;
|
| +
|
| +/*
|
| + * Use Probe directive to capture the Scope, Injector and Element from any DOM
|
| + * location into root-scope. This is useful for testing to get a hold of
|
| + * any directive.
|
| + *
|
| + * <div some-directive probe="myProbe">..</div>
|
| + *
|
| + * rootScope.myProbe.directive(SomeAttrDirective);
|
| + */
|
| +@NgDirective(selector: '[probe]')
|
| +class Probe implements NgDetachAware {
|
| + final Scope scope;
|
| + final Injector injector;
|
| + final Element element;
|
| + final NodeAttrs _attrs;
|
| +
|
| + Probe(this.scope, this.injector, this.element, this._attrs) {
|
| + scope.$root[_attrs['probe']] = this;
|
| + }
|
| +
|
| + detach() => scope.$root[_attrs['probe']] = null;
|
| +
|
| + /**
|
| + * Retrieve a Directive at the current element.
|
| + */
|
| + directive(Type type) => injector.get(type);
|
| +}
|
| +
|
|
|