| Index: third_party/pkg/angular/lib/mock/test_bed.dart
|
| diff --git a/third_party/pkg/angular/lib/mock/test_bed.dart b/third_party/pkg/angular/lib/mock/test_bed.dart
|
| index ac1b5ddc8e653fddaa887a5a66272460a72ecc35..b03577edb84075c56f7e3e8c49bc39b65f55b2e2 100644
|
| --- a/third_party/pkg/angular/lib/mock/test_bed.dart
|
| +++ b/third_party/pkg/angular/lib/mock/test_bed.dart
|
| @@ -10,14 +10,14 @@ class TestBed {
|
| final Injector injector;
|
| final Scope rootScope;
|
| final Compiler compiler;
|
| - final Parser parser;
|
| -
|
| + final Parser _parser;
|
| + final Expando expando;
|
|
|
| Element rootElement;
|
| List<Node> rootElements;
|
| - Block rootBlock;
|
| + View rootView;
|
|
|
| - TestBed(this.injector, this.rootScope, this.compiler, this.parser);
|
| + TestBed(this.injector, this.rootScope, this.compiler, this._parser, this.expando);
|
|
|
|
|
| /**
|
| @@ -48,11 +48,11 @@ class TestBed {
|
| } else {
|
| throw 'Expecting: String, Node, or List<Node> got $html.';
|
| }
|
| - rootElement = rootElements[0];
|
| + rootElement = rootElements.length > 0 && rootElements[0] is Element ? rootElements[0] : null;
|
| if (directives == null) {
|
| directives = injector.get(DirectiveMap);
|
| }
|
| - rootBlock = compiler(rootElements, directives)(injector, rootElements);
|
| + rootView = compiler(rootElements, directives)(injector, rootElements);
|
| return rootElement;
|
| }
|
|
|
| @@ -70,12 +70,12 @@ class TestBed {
|
| }
|
|
|
| /**
|
| - * Triggern a specific DOM element on a given node to test directives
|
| + * Trigger a specific DOM element on a given node to test directives
|
| * which listen to events.
|
| */
|
| triggerEvent(element, name, [type='MouseEvent']) {
|
| element.dispatchEvent(new Event.eventType(type, name));
|
| - // Since we are manually triggering event we need to simpulate apply();
|
| + // Since we are manually triggering event we need to simulate apply();
|
| rootScope.apply();
|
| }
|
|
|
| @@ -88,4 +88,15 @@ class TestBed {
|
| triggerEvent(element, 'change');
|
| rootScope.apply();
|
| }
|
| +
|
| + getProbe(Node node) {
|
| + while (node != null) {
|
| + ElementProbe probe = expando[node];
|
| + if (probe != null) return probe;
|
| + node = node.parent;
|
| + }
|
| + throw 'Probe not found.';
|
| + }
|
| +
|
| + getScope(Node node) => getProbe(node).scope;
|
| }
|
|
|