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

Unified Diff: third_party/pkg/angular/test/_specs.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/test/_specs.dart
diff --git a/third_party/pkg/angular/test/_specs.dart b/third_party/pkg/angular/test/_specs.dart
index b75571ac6ddf0b03cb59404fea3471f7df04eaf7..88b46e6e95d925229fc52e321adac3b9c4fdf935 100644
--- a/third_party/pkg/angular/test/_specs.dart
+++ b/third_party/pkg/angular/test/_specs.dart
@@ -1,11 +1,10 @@
library ng_specs;
-
import 'dart:html';
-import 'dart:mirrors' as mirror;
import 'package:unittest/unittest.dart' as unit;
import 'package:angular/angular.dart';
import 'package:angular/mock/module.dart';
+import 'package:collection/wrappers.dart' show DelegatingList;
import 'jasmine_syntax.dart';
@@ -84,7 +83,7 @@ class Expect {
toEqualSelect(options) {
var actualOptions = [];
- for(var option in actual.querySelectorAll('option')) {
+ for (var option in actual.querySelectorAll('option')) {
if (option.selected) {
actualOptions.add([option.value]);
} else {
@@ -118,11 +117,11 @@ class NotExpect {
toHaveClass(cls) => unit.expect(actual.classes.contains(cls), false, reason: ' Expected ${actual} to not have css class ${cls}');
toBe(expected) => unit.expect(actual,
- unit.predicate((actual) => !identical(expected, actual), '$expected'));
+ unit.predicate((actual) => !identical(expected, actual), 'not $expected'));
toEqual(expected) => unit.expect(actual,
- unit.predicate((actual) => expected != actual, '$expected'));
+ unit.predicate((actual) => expected != actual, 'not $expected'));
toContain(expected) => unit.expect(actual,
- unit.predicate((actual) => !actual.contains(expected), '$expected'));
+ unit.predicate((actual) => !actual.contains(expected), 'not $expected'));
}
class ExceptionContains extends unit.Matcher {
@@ -159,16 +158,14 @@ class GetterSetter {
}
var getterSetter = new GetterSetter();
-class JQuery implements List<Node> {
- List<Node> _list = [];
-
- JQuery([selector]) {
+class JQuery extends DelegatingList<Node> {
+ JQuery([selector]) : super([]) {
if (selector == null) {
// do nothing;
} else if (selector is String) {
- _list.addAll(es(selector));
+ addAll(es(selector));
} else if (selector is List) {
- _list.addAll(selector);
+ addAll(selector);
} else if (selector is Node) {
add(selector);
} else {
@@ -176,8 +173,6 @@ class JQuery implements List<Node> {
}
}
- noSuchMethod(Invocation invocation) => mirror.reflect(_list).delegate(invocation);
-
_toHtml(node, [bool outer = false]) {
if (node is Comment) {
return '<!--${node.text}-->';
@@ -190,7 +185,7 @@ class JQuery implements List<Node> {
// TODO(dart): ?value does not work, since value was passed. :-(
var setterMode = value != null;
var result = setterMode ? this : '';
- _list.forEach((node) {
+ forEach((node) {
if (setterMode) {
setter(node, value);
} else {
@@ -225,9 +220,9 @@ class JQuery implements List<Node> {
(n is Element ? (n as Element).querySelectorAll(selector) : [])));
hasClass(String name) => fold(false, (hasClass, node) =>
hasClass || (node is Element && (node as Element).classes.contains(name)));
- addClass(String name) => _list.forEach((node) =>
+ addClass(String name) => forEach((node) =>
(node is Element) ? (node as Element).classes.add(name) : null);
- removeClass(String name) => _list.forEach((node) =>
+ removeClass(String name) => forEach((node) =>
(node is Element) ? (node as Element).classes.remove(name) : null);
css(String name, [String value]) => accessor(
(Element n) => n.style.getPropertyValue(name),

Powered by Google App Engine
This is Rietveld 408576698