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

Unified Diff: third_party/pkg/angular/lib/mock/test_bed.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/angular/lib/mock/probe.dart ('k') | third_party/pkg/angular/lib/mock/test_injection.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « third_party/pkg/angular/lib/mock/probe.dart ('k') | third_party/pkg/angular/lib/mock/test_injection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698