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

Unified Diff: third_party/pkg/angular/lib/introspection.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
Index: third_party/pkg/angular/lib/introspection.dart
diff --git a/third_party/pkg/angular/lib/introspection.dart b/third_party/pkg/angular/lib/introspection.dart
index 04a20246fca4cb9bf98395c29e519edef1803747..ee566c836431b9936a1b412fab65959b7481733d 100644
--- a/third_party/pkg/angular/lib/introspection.dart
+++ b/third_party/pkg/angular/lib/introspection.dart
@@ -1,17 +1,18 @@
part of angular;
/**
- * A global write only variable which keeps track of objects attached to the elements.
- * This is usefull for debugging AngularDart application from the browser's REPL.
+ * A global write only variable which keeps track of objects attached to the
+ * elements. This is useful for debugging AngularDart application from the
+ * browser's REPL.
*/
-Expando _elementExpando = new Expando('element');
+var _elementExpando = new Expando('element');
/**
* Return the closest [ElementProbe] object for a given [Element].
*
- * NOTE: This global method is here to make it easier to debug Angular application from
- * the browser's REPL, unit or end-to-end tests. The function is not intended to
- * be called from Angular application.
+ * NOTE: This global method is here to make it easier to debug Angular
+ * application from the browser's REPL, unit or end-to-end tests. The
+ * function is not intended to be called from Angular application.
*/
ElementProbe ngProbe(dom.Node node) {
while(node != null) {
@@ -26,9 +27,9 @@ ElementProbe ngProbe(dom.Node node) {
/**
* Return the [Injector] associated with a current [Element].
*
- * **NOTE**: This global method is here to make it easier to debug Angular application from
- * the browser's REPL, unit or end-to-end tests. The function is not intended to be called
- * from Angular application.
+ * **NOTE**: This global method is here to make it easier to debug Angular
+ * application from the browser's REPL, unit or end-to-end tests. The function
+ * is not intended to be called from Angular application.
*/
Injector ngInjector(dom.Node node) => ngProbe(node).injector;
@@ -36,14 +37,15 @@ Injector ngInjector(dom.Node node) => ngProbe(node).injector;
/**
* Return the [Scope] associated with a current [Element].
*
- * **NOTE**: This global method is here to make it easier to debug Angular application from
- * the browser's REPL, unit or end-to-end tests. The function is not intended to be called
- * from Angular application.
+ * **NOTE**: This global method is here to make it easier to debug Angular
+ * application from the browser's REPL, unit or end-to-end tests. The function
+ * is not intended to be called from Angular application.
*/
Scope ngScope(dom.Node node) => ngProbe(node).scope;
-List<dom.Element> ngQuery(dom.Node element, String selector, [String containsText]) {
+List<dom.Element> ngQuery(dom.Node element, String selector,
+ [String containsText]) {
var list = [];
var children = [element];
if ((element is dom.Element) && element.shadowRoot != null) {
@@ -64,9 +66,9 @@ List<dom.Element> ngQuery(dom.Node element, String selector, [String containsTex
/**
* Return a List of directive controllers associated with a current [Element].
*
- * **NOTE**: This global method is here to make it easier to debug Angular application from
- * the browser's REPL, unit or end-to-end tests. The function is not intended to be called
- * from Angular application.
+ * **NOTE**: This global method is here to make it easier to debug Angular
+ * application from the browser's REPL, unit or end-to-end tests. The function
+ * is not intended to be called from Angular application.
*/
List<Object> ngDirectives(dom.Node node) {
ElementProbe probe = _elementExpando[node];
@@ -74,11 +76,12 @@ List<Object> ngDirectives(dom.Node node) {
}
_publishToJavaScript() {
- js.context['ngProbe'] = (dom.Node node) => _jsProbe(ngProbe(node));
- js.context['ngInjector'] = (dom.Node node) => _jsInjector(ngInjector(node));
- js.context['ngScope'] = (dom.Node node) => _jsScope(ngScope(node));
- js.context['ngQuery'] = (dom.Node node, String selector, [String containsText]) =>
- new js.JsArray.from(ngQuery(node, selector, containsText));
+ js.context
+ ..['ngProbe'] = (dom.Node node) => _jsProbe(ngProbe(node))
+ ..['ngInjector'] = (dom.Node node) => _jsInjector(ngInjector(node))
+ ..['ngScope'] = (dom.Node node) => _jsScope(ngScope(node))
+ ..['ngQuery'] = (dom.Node node, String selector, [String containsText]) =>
+ new js.JsArray.from(ngQuery(node, selector, containsText));
}
js.JsObject _jsProbe(ElementProbe probe) {
@@ -90,18 +93,17 @@ js.JsObject _jsProbe(ElementProbe probe) {
})..['_dart_'] = probe;
}
-js.JsObject _jsInjector(Injector injector) {
- return new js.JsObject.jsify({
- "get": injector.get
- })..['_dart_'] = injector;
-}
+js.JsObject _jsInjector(Injector injector) =>
+ new js.JsObject.jsify({"get": injector.get})..['_dart_'] = injector;
js.JsObject _jsScope(Scope scope) {
return new js.JsObject.jsify({
- "\$apply": scope.$apply,
- "\$digest": scope.$digest,
- "get": (name) => scope[name],
- "set": (name, value) => scope[name] = value
+ "apply": scope.apply,
+ "digest": scope.rootScope.digest,
+ "flush": scope.rootScope.flush,
+ "context": scope.context,
+ "get": (name) => scope.context[name],
+ "set": (name, value) => scope.context[name] = value
})..['_dart_'] = scope;
}

Powered by Google App Engine
This is Rietveld 408576698