feat(test_lib): add method to compare stringified DOM element
Closes #2106
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user