diff --git a/modules/@angular/common/test/directives/ng_for_spec.ts b/modules/@angular/common/test/directives/ng_for_spec.ts index 649d6ed85d..d5bf5290c7 100644 --- a/modules/@angular/common/test/directives/ng_for_spec.ts +++ b/modules/@angular/common/test/directives/ng_for_spec.ts @@ -16,7 +16,7 @@ import {By} from '@angular/platform-browser/src/dom/debug/by'; export function main() { describe('ngFor', () => { - var TEMPLATE = + const TEMPLATE = '
{{item.toString()}};
'; it('should reflect initial elements', @@ -106,7 +106,7 @@ export function main() { inject( [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { - var template = + const template = ''; tcb.overrideTemplate(TestComponent, template) @@ -139,7 +139,7 @@ export function main() { inject( [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { - var template = ''; + const template = ''; tcb.overrideTemplate(TestComponent, template) .createAsync(TestComponent) .then((fixture) => { @@ -176,13 +176,10 @@ export function main() { (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { tcb.overrideTemplate(TestComponent, TEMPLATE).createAsync(TestComponent).then((fixture) => { fixture.debugElement.componentInstance.items = 'whaaa'; - try { - fixture.detectChanges(); - } catch (e) { - expect(e.message).toContain( - `Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables such as Arrays.`); - async.done(); - } + expect(() => fixture.detectChanges()) + .toThrowError( + /Cannot find a differ supporting object 'whaaa' of type 'string'. NgFor only supports binding to Iterables such as Arrays/); + async.done(); }); })); @@ -221,7 +218,7 @@ export function main() { inject( [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { - var template = '
' + + const template = '
' + '
' + '
' + '{{subitem}}-{{item.length}};' + @@ -250,7 +247,7 @@ export function main() { inject( [TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { - var template = '