refactor(tests): simplify code (#11485)

This commit is contained in:
Victor Berchet
2016-09-09 12:04:38 -07:00
committed by Evan Martin
parent f5d44a42c9
commit 5a4e46db20
21 changed files with 505 additions and 544 deletions

View File

@ -67,13 +67,13 @@ export function main() {
it('should work with mutable objects', async(() => {
let fixture = TestBed.createComponent(TestComp);
let mutable: number[] = [1];
fixture.debugElement.componentInstance.data = mutable;
fixture.componentInstance.data = mutable;
fixture.detectChanges();
expect(fixture.debugElement.nativeElement).toHaveText('[\n 1\n]');
expect(fixture.nativeElement).toHaveText('[\n 1\n]');
mutable.push(2);
fixture.detectChanges();
expect(fixture.debugElement.nativeElement).toHaveText('[\n 1,\n 2\n]');
expect(fixture.nativeElement).toHaveText('[\n 1,\n 2\n]');
}));
});

View File

@ -96,13 +96,13 @@ export function main() {
it('should work with mutable arrays', async(() => {
let fixture = TestBed.createComponent(TestComp);
let mutable: number[] = [1, 2];
fixture.debugElement.componentInstance.data = mutable;
fixture.componentInstance.data = mutable;
fixture.detectChanges();
expect(fixture.debugElement.nativeElement).toHaveText('2');
expect(fixture.nativeElement).toHaveText('2');
mutable.push(3);
fixture.detectChanges();
expect(fixture.debugElement.nativeElement).toHaveText('2,3');
expect(fixture.nativeElement).toHaveText('2,3');
}));
});
});