X Tutup
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion modules/angular2/test/facade/collection_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ import {
ListWrapper,
StringMap,
StringMapWrapper,
MapWrapper
MapWrapper,
iterableToList
} from 'angular2/src/facade/collection';

class IterableClass {
list: List<any>;
constructor(list) {
this.list = list;
}
[Symbol.iterator]() {
return this.list[Symbol.iterator]();
}
}

export function main() {
describe('ListWrapper', () => {
var l: List<int>;
Expand Down Expand Up @@ -78,6 +89,20 @@ export function main() {
});
});

describe('iterableToList', () => {

it('should return a List from iterable', () => {
var list = [1, 2, 3, 4, 5, 6];
expect(iterableToList(list)).toEqual([1, 2, 3, 4, 5, 6]);
});

it('should return a List from custom iterable class', () => {
var list = new IterableClass([1, 2, 3, 4, 5, 6]);
expect(iterableToList(list)).toEqual([1, 2, 3, 4, 5, 6]);
});

});

describe('StringMapWrapper', () => {
describe('equals', () => {
it('should return true when comparing empty maps',
Expand Down
X Tutup