feat(test_lib): add method to compare stringified DOM element

Closes #2106
This commit is contained in:
Marc Laval
2015-05-22 17:47:13 +02:00
parent fb42d5908e
commit c6335c128e
6 changed files with 88 additions and 25 deletions
+6 -2
View File
@@ -172,8 +172,12 @@ class ListWrapper {
l.removeRange(from, to);
return sub;
}
static void sort(List l, compareFn(a, b)) {
l.sort(compareFn);
static void sort(List l, [compareFn(a, b) = null]) {
if (compareFn == null) {
l.sort();
} else {
l.sort(compareFn);
}
}
// JS splice, slice, fill functions can take start < 0 which indicates a position relative to
+8 -2
View File
@@ -1,4 +1,4 @@
import {isJsObject, global} from 'angular2/src/facade/lang';
import {isJsObject, global, isPresent} from 'angular2/src/facade/lang';
export var List = global.Array;
export var Map = global.Map;
@@ -231,7 +231,13 @@ export class ListWrapper {
return l.slice(from, to === null ? undefined : to);
}
static splice<T>(l: List<T>, from: int, length: int): List<T> { return l.splice(from, length); }
static sort<T>(l: List<T>, compareFn: (a: T, b: T) => number) { l.sort(compareFn); }
static sort<T>(l: List<T>, compareFn?: (a: T, b: T) => number) {
if (isPresent(compareFn)) {
l.sort(compareFn);
} else {
l.sort();
}
}
}
export function isListLikeIterable(obj): boolean {