diff --git a/modules/@angular/common/test/directives/ng_for_spec.ts b/modules/@angular/common/test/directives/ng_for_spec.ts index 284bc27320..43cd3fd62f 100644 --- a/modules/@angular/common/test/directives/ng_for_spec.ts +++ b/modules/@angular/common/test/directives/ng_for_spec.ts @@ -7,7 +7,7 @@ */ import {CommonModule} from '@angular/common'; -import {Component, ContentChild, TemplateRef} from '@angular/core'; +import {Component} from '@angular/core'; import {ComponentFixture, TestBed, async} from '@angular/core/testing'; import {By} from '@angular/platform-browser/src/dom/debug/by'; import {expect} from '@angular/platform-browser/testing/matchers'; @@ -29,10 +29,7 @@ export function main() { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ - TestComponent, - ComponentUsingTestComponent, - ], + declarations: [TestComponent], imports: [CommonModule], }); }); @@ -77,7 +74,7 @@ export function main() { })); it('should iterate over an array of objects', async(() => { - const template = ''; + const template = ''; fixture = createTestComponent(template); // INIT @@ -95,7 +92,7 @@ export function main() { })); it('should gracefully handle nulls', async(() => { - const template = ''; + const template = ''; fixture = createTestComponent(template); detectChangesAndExpectText(''); @@ -140,12 +137,8 @@ export function main() { })); it('should repeat over nested arrays', async(() => { - const template = '
' + - '
' + - '
' + - '{{subitem}}-{{item.length}};' + - '
|' + - '
' + + const template = '
' + + '
{{subitem}}-{{item.length}};
|' + '
'; fixture = createTestComponent(template); @@ -157,10 +150,9 @@ export function main() { })); it('should repeat over nested arrays with no intermediate element', async(() => { - const template = '
'; + const template = '
' + + '
{{subitem}}-{{item.length}};
' + + '
'; fixture = createTestComponent(template); getComponent().items = [['a', 'b'], ['c']]; @@ -170,10 +162,11 @@ export function main() { detectChangesAndExpectText('e-1;f-2;g-2;'); })); - it('should repeat over nested ngIf that are the last node in the ngFor temlate', async(() => { - const template = - `
`; + it('should repeat over nested ngIf that are the last node in the ngFor template', async(() => { + const template = `
` + + `
{{i}}|
` + + `
even|
` + + `
`; fixture = createTestComponent(template); @@ -189,8 +182,7 @@ export function main() { })); it('should display indices correctly', async(() => { - const template = - '
{{i.toString()}}
'; + const template = '{{i.toString()}}'; fixture = createTestComponent(template); getComponent().items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; @@ -202,7 +194,7 @@ export function main() { it('should display first item correctly', async(() => { const template = - '
{{isFirst.toString()}}
'; + '{{isFirst.toString()}}'; fixture = createTestComponent(template); getComponent().items = [0, 1, 2]; @@ -214,7 +206,7 @@ export function main() { it('should display last item correctly', async(() => { const template = - '
{{isLast.toString()}}
'; + '{{isLast.toString()}}'; fixture = createTestComponent(template); getComponent().items = [0, 1, 2]; @@ -226,7 +218,7 @@ export function main() { it('should display even items correctly', async(() => { const template = - '
{{isEven.toString()}}
'; + '{{isEven.toString()}}'; fixture = createTestComponent(template); getComponent().items = [0, 1, 2]; @@ -238,7 +230,7 @@ export function main() { it('should display odd items correctly', async(() => { const template = - '
{{isOdd.toString()}}
'; + '{{isOdd.toString()}}'; fixture = createTestComponent(template); getComponent().items = [0, 1, 2, 3]; @@ -249,55 +241,38 @@ export function main() { })); it('should allow to use a custom template', async(() => { - const tcTemplate = - ''; - TestBed.overrideComponent(TestComponent, {set: {template: tcTemplate}}); - const cutTemplate = - '
  • {{i}}: {{item}};
  • '; - TestBed.overrideComponent(ComponentUsingTestComponent, {set: {template: cutTemplate}}); - fixture = TestBed.createComponent(ComponentUsingTestComponent); - - const testComponent = fixture.debugElement.children[0]; - testComponent.componentInstance.items = ['a', 'b', 'c']; + const template = + '' + + ''; + fixture = createTestComponent(template); + getComponent().items = ['a', 'b', 'c']; fixture.detectChanges(); - expect(testComponent.nativeElement).toHaveText('0: a;1: b;2: c;'); + detectChangesAndExpectText('0: a;1: b;2: c;'); })); it('should use a default template if a custom one is null', async(() => { - const testTemplate = ``; - TestBed.overrideComponent(TestComponent, {set: {template: testTemplate}}); - const cutTemplate = - '
  • {{i}}: {{item}};
  • '; - TestBed.overrideComponent(ComponentUsingTestComponent, {set: {template: cutTemplate}}); - fixture = TestBed.createComponent(ComponentUsingTestComponent); - - const testComponent = fixture.debugElement.children[0]; - testComponent.componentInstance.items = ['a', 'b', 'c']; + const template = + ``; + fixture = createTestComponent(template); + getComponent().items = ['a', 'b', 'c']; fixture.detectChanges(); - expect(testComponent.nativeElement).toHaveText('0: a;1: b;2: c;'); + detectChangesAndExpectText('0: a;1: b;2: c;'); })); it('should use a custom template when both default and a custom one are present', async(() => { - const testTemplate = ``; - TestBed.overrideComponent(TestComponent, {set: {template: testTemplate}}); - const cutTemplate = - '
  • {{i}}: {{item}};
  • '; - TestBed.overrideComponent(ComponentUsingTestComponent, {set: {template: cutTemplate}}); - fixture = TestBed.createComponent(ComponentUsingTestComponent); - - const testComponent = fixture.debugElement.children[0]; - testComponent.componentInstance.items = ['a', 'b', 'c']; + const template = + '{{i}};' + + ''; + fixture = createTestComponent(template); + getComponent().items = ['a', 'b', 'c']; fixture.detectChanges(); - expect(testComponent.nativeElement).toHaveText('0: a;1: b;2: c;'); + detectChangesAndExpectText('0: a;1: b;2: c;'); })); describe('track by', () => { it('should console.warn if trackBy is not a function', async(() => { // TODO(vicb): expect a warning message when we have a proper log service - const template = - ``; + const template = `

    `; fixture = createTestComponent(template); fixture.componentInstance.value = 0; fixture.detectChanges(); @@ -305,8 +280,7 @@ export function main() { it('should track by identity when trackBy is to `null` or `undefined`', async(() => { // TODO(vicb): expect no warning message when we have a proper log service - const template = - ``; + const template = `

    {{ item }}

    `; fixture = createTestComponent(template); fixture.componentInstance.items = ['a', 'b', 'c']; fixture.componentInstance.value = null; @@ -317,7 +291,7 @@ export function main() { it('should set the context to the component instance', async(() => { const template = - ``; + `

    `; fixture = createTestComponent(template); thisArg = null; @@ -327,9 +301,7 @@ export function main() { it('should not replace tracked items', async(() => { const template = - ``; + `

    {{items[i]}}

    `; fixture = createTestComponent(template); const buildItemList = () => { @@ -345,7 +317,7 @@ export function main() { it('should update implicit local variable on view', async(() => { const template = - `
    `; + `
    {{item['color']}}
    `; fixture = createTestComponent(template); getComponent().items = [{'id': 'a', 'color': 'blue'}]; @@ -357,7 +329,7 @@ export function main() { it('should move items around and keep them updated ', async(() => { const template = - `
    `; + `
    {{item['color']}}
    `; fixture = createTestComponent(template); getComponent().items = [{'id': 'a', 'color': 'blue'}, {'id': 'b', 'color': 'yellow'}]; @@ -368,8 +340,7 @@ export function main() { })); it('should handle added and removed items properly when tracking by index', async(() => { - const template = - `
    `; + const template = `
    {{item}}
    `; fixture = createTestComponent(template); getComponent().items = ['a', 'b', 'c', 'd']; @@ -389,7 +360,6 @@ class Foo { @Component({selector: 'test-cmp', template: ''}) class TestComponent { - @ContentChild(TemplateRef) contentTpl: TemplateRef; value: any; items: any[] = [1, 2]; trackById(index: number, item: any): string { return item['id']; } @@ -397,12 +367,7 @@ class TestComponent { trackByContext(): void { thisArg = this; } } -@Component({selector: 'outer-cmp', template: ''}) -class ComponentUsingTestComponent { - items: any = [1, 2]; -} - -const TEMPLATE = '
    {{item.toString()}};
    '; +const TEMPLATE = '
    {{item.toString()}};
    '; function createTestComponent(template: string = TEMPLATE): ComponentFixture { return TestBed.overrideComponent(TestComponent, {set: {template: template}}) diff --git a/modules/@angular/common/test/directives/ng_if_spec.ts b/modules/@angular/common/test/directives/ng_if_spec.ts index 39c30a6422..e0392cb395 100644 --- a/modules/@angular/common/test/directives/ng_if_spec.ts +++ b/modules/@angular/common/test/directives/ng_if_spec.ts @@ -9,6 +9,7 @@ import {CommonModule} from '@angular/common'; import {Component} from '@angular/core'; import {ComponentFixture, TestBed, async} from '@angular/core/testing'; +import {By} from '@angular/platform-browser/src/dom/debug/by'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {expect} from '@angular/platform-browser/testing/matchers'; @@ -28,131 +29,114 @@ export function main() { }); it('should work in a template attribute', async(() => { - const template = '
    hello
    '; + const template = 'hello'; fixture = createTestComponent(template); - fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('hello'); })); - it('should work in a template element', async(() => { - const template = - '
    '; - + it('should work on a template element', async(() => { + const template = ''; fixture = createTestComponent(template); fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); expect(fixture.nativeElement).toHaveText('hello2'); })); it('should toggle node when condition changes', async(() => { - const template = '
    hello
    '; - + const template = 'hello'; fixture = createTestComponent(template); getComponent().booleanCondition = false; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(0); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(0); expect(fixture.nativeElement).toHaveText(''); getComponent().booleanCondition = true; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('hello'); getComponent().booleanCondition = false; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(0); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(0); expect(fixture.nativeElement).toHaveText(''); })); it('should handle nested if correctly', async(() => { const template = - '
    '; + '
    hello
    '; fixture = createTestComponent(template); getComponent().booleanCondition = false; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(0); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(0); expect(fixture.nativeElement).toHaveText(''); getComponent().booleanCondition = true; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('hello'); getComponent().nestedBooleanCondition = false; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(0); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(0); expect(fixture.nativeElement).toHaveText(''); getComponent().nestedBooleanCondition = true; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('hello'); getComponent().booleanCondition = false; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(0); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(0); expect(fixture.nativeElement).toHaveText(''); })); it('should update several nodes with if', async(() => { - const template = '
    ' + - 'helloNumber' + - 'helloString' + - 'helloFunction' + - '
    '; + const template = 'helloNumber' + + 'helloString' + + 'helloFunction'; fixture = createTestComponent(template); fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(3); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(3); expect(getDOM().getText(fixture.nativeElement)) .toEqual('helloNumberhelloStringhelloFunction'); getComponent().numberCondition = 0; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('helloString'); getComponent().numberCondition = 1; getComponent().stringCondition = 'bar'; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + expect(fixture.debugElement.queryAll(By.css('span')).length).toEqual(1); expect(fixture.nativeElement).toHaveText('helloNumber'); })); - it('should not add the element twice if the condition goes from true to true (JS)', - async(() => { - const template = '
    hello
    '; + it('should not add the element twice if the condition goes from truthy to truthy', async(() => { + const template = 'hello'; fixture = createTestComponent(template); fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + let els = fixture.debugElement.queryAll(By.css('span')); + expect(els.length).toEqual(1); + getDOM().addClass(els[0].nativeElement, 'marker'); expect(fixture.nativeElement).toHaveText('hello'); getComponent().numberCondition = 2; fixture.detectChanges(); - expect(getDOM().querySelectorAll(fixture.nativeElement, 'span').length).toEqual(1); + els = fixture.debugElement.queryAll(By.css('span')); + expect(els.length).toEqual(1); + expect(getDOM().hasClass(els[0].nativeElement, 'marker')).toBe(true); + expect(fixture.nativeElement).toHaveText('hello'); })); - - it('should not recreate the element if the condition goes from true to true (JS)', async(() => { - const template = '
    hello
    '; - - fixture = createTestComponent(template); - - fixture.detectChanges(); - getDOM().addClass(getDOM().querySelector(fixture.nativeElement, 'span'), 'foo'); - - getComponent().numberCondition = 2; - fixture.detectChanges(); - expect(getDOM().hasClass(getDOM().querySelector(fixture.nativeElement, 'span'), 'foo')) - .toBe(true); - })); }); } diff --git a/modules/@angular/common/test/directives/ng_plural_spec.ts b/modules/@angular/common/test/directives/ng_plural_spec.ts index 65fb9c8fde..3b0927b826 100644 --- a/modules/@angular/common/test/directives/ng_plural_spec.ts +++ b/modules/@angular/common/test/directives/ng_plural_spec.ts @@ -33,11 +33,10 @@ export function main() { }); it('should display the template according to the exact value', async(() => { - const template = '
    ' + - '
      ' + + const template = '
        ' + '' + '' + - '
    '; + ''; fixture = createTestComponent(template); @@ -51,10 +50,9 @@ export function main() { // https://github.com/angular/angular/issues/9868 // https://github.com/angular/angular/issues/9882 it('should not throw when ngPluralCase contains expressions', async(() => { - const template = '
    ' + - '
      ' + + const template = '
        ' + '' + - '
    '; + ''; fixture = createTestComponent(template); @@ -64,11 +62,10 @@ export function main() { it('should be applicable to elements', async(() => { - const template = '
    ' + - '' + + const template = '' + '' + '' + - '
    '; + '
    '; fixture = createTestComponent(template); @@ -80,11 +77,10 @@ export function main() { })); it('should display the template according to the category', async(() => { - const template = '
    ' + - '
      ' + + const template = '
        ' + '' + '' + - '
    '; + ''; fixture = createTestComponent(template); @@ -96,11 +92,10 @@ export function main() { })); it('should default to other when no matches are found', async(() => { - const template = '
    ' + - '
      ' + + const template = '
        ' + '' + '' + - '
    '; + ''; fixture = createTestComponent(template); @@ -109,11 +104,10 @@ export function main() { })); it('should prioritize value matches over category matches', async(() => { - const template = '
    ' + - '
      ' + + const template = '
        ' + '' + '' + - '
    '; + ''; fixture = createTestComponent(template); diff --git a/modules/@angular/common/test/directives/ng_style_spec.ts b/modules/@angular/common/test/directives/ng_style_spec.ts index 3c1329acdc..5ac554791b 100644 --- a/modules/@angular/common/test/directives/ng_style_spec.ts +++ b/modules/@angular/common/test/directives/ng_style_spec.ts @@ -29,22 +29,19 @@ export function main() { it('should add styles specified in an object literal', async(() => { const template = `
    `; fixture = createTestComponent(template); - fixture.detectChanges(); expectNativeEl(fixture).toHaveCssStyle({'max-width': '40px'}); })); it('should add and change styles specified in an object expression', async(() => { const template = `
    `; - fixture = createTestComponent(template); - let expr: {[k: string]: string}; getComponent().expr = {'max-width': '40px'}; fixture.detectChanges(); expectNativeEl(fixture).toHaveCssStyle({'max-width': '40px'}); - expr = getComponent().expr; + let expr = getComponent().expr; expr['max-width'] = '30%'; fixture.detectChanges(); expectNativeEl(fixture).toHaveCssStyle({'max-width': '30%'}); diff --git a/modules/@angular/common/test/directives/ng_switch_spec.ts b/modules/@angular/common/test/directives/ng_switch_spec.ts index 3030cc4d93..11a80a5327 100644 --- a/modules/@angular/common/test/directives/ng_switch_spec.ts +++ b/modules/@angular/common/test/directives/ng_switch_spec.ts @@ -33,11 +33,10 @@ export function main() { describe('switch value changes', () => { it('should switch amongst when values', () => { - const template = '
    ' + - '
      ' + - '' + - '' + - '
    '; + const template = '
      ' + + '
    • when a
    • ' + + '
    • when b
    • ' + + '
    '; fixture = createTestComponent(template); @@ -51,11 +50,10 @@ export function main() { }); it('should switch amongst when values with fallback to default', () => { - const template = '
    ' + - '
      ' + - '
    • when a
    • ' + - '
    • when default
    • ' + - '
    '; + const template = '
      ' + + '
    • when a
    • ' + + '
    • when default
    • ' + + '
    '; fixture = createTestComponent(template); detectChangesAndExpectText('when default'); @@ -71,15 +69,14 @@ export function main() { }); it('should support multiple whens with the same value', () => { - const template = '
    ' + - '
      ' + - '' + - '' + - '' + - '' + - '' + - '' + - '
    '; + const template = '
      ' + + '
    • when a1;
    • ' + + '
    • when b1;
    • ' + + '
    • when a2;
    • ' + + '
    • when b2;
    • ' + + '
    • when default1;
    • ' + + '
    • when default2;
    • ' + + '
    '; fixture = createTestComponent(template); detectChangesAndExpectText('when default1;when default2;'); @@ -94,12 +91,11 @@ export function main() { describe('when values changes', () => { it('should switch amongst when values', () => { - const template = '
    ' + - '
      ' + - '' + - '' + - '' + - '
    '; + const template = '
      ' + + '
    • when 1;
    • ' + + '
    • when 2;
    • ' + + '
    • when default;
    • ' + + '
    '; fixture = createTestComponent(template); getComponent().when1 = 'a'; @@ -148,11 +144,10 @@ export function main() { }); it('should create the default case if there is no other case', () => { - const template = '
    ' + - '
      ' + - '' + - '' + - '
    '; + const template = '
      ' + + '
    • when default1;
    • ' + + '
    • when default2;
    • ' + + '
    '; fixture = createTestComponent(template); detectChangesAndExpectText('when default1;when default2;'); @@ -160,15 +155,14 @@ export function main() { }); it('should allow defaults before cases', () => { - const template = '
    ' + - '
      ' + - '' + - '' + - '' + - '' + - '' + - '' + - '
    '; + const template = '
      ' + + '
    • when default1;
    • ' + + '
    • when default2;
    • ' + + '
    • when a1;
    • ' + + '
    • when b1;
    • ' + + '
    • when a2;
    • ' + + '
    • when b2;
    • ' + + '
    '; fixture = createTestComponent(template); detectChangesAndExpectText('when default1;when default2;'); diff --git a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts index ac1a17b816..6ae521c409 100644 --- a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts +++ b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts @@ -34,29 +34,22 @@ export function main() { }); }); - it('should do nothing if templateRef is null', async(() => { - const template = ``; + it('should do nothing if templateRef is `null`', async(() => { + const template = ``; fixture = createTestComponent(template); - detectChangesAndExpectText(''); })); it('should insert content specified by TemplateRef', async(() => { - const template = - ``; + const template = `` + + ``; fixture = createTestComponent(template); - - detectChangesAndExpectText(''); - - const refs = fixture.debugElement.children[0].references['refs']; - - setTplRef(refs.tplRefs.first); detectChangesAndExpectText('foo'); })); - it('should clear content if TemplateRef becomes null', async(() => { - const template = - ``; + it('should clear content if TemplateRef becomes `null`', async(() => { + const template = `` + + ``; fixture = createTestComponent(template); fixture.detectChanges(); const refs = fixture.debugElement.children[0].references['refs']; @@ -70,7 +63,8 @@ export function main() { it('should swap content if TemplateRef changes', async(() => { const template = - ``; + `` + + ``; fixture = createTestComponent(template); fixture.detectChanges(); @@ -83,70 +77,47 @@ export function main() { detectChangesAndExpectText('bar'); })); - it('should display template if context is null', async(() => { - const template = - ``; + it('should display template if context is `null`', async(() => { + const template = `` + + ``; fixture = createTestComponent(template); - detectChangesAndExpectText(''); - - const refs = fixture.debugElement.children[0].references['refs']; - - setTplRef(refs.tplRefs.first); detectChangesAndExpectText('foo'); })); it('should reflect initial context and changes', async(() => { - const template = - ``; + const template = `` + + ``; fixture = createTestComponent(template); fixture.detectChanges(); - - const refs = fixture.debugElement.children[0].references['refs']; - setTplRef(refs.tplRefs.first); - detectChangesAndExpectText('bar'); fixture.componentInstance.context.foo = 'alter-bar'; - detectChangesAndExpectText('alter-bar'); })); - it('should reflect user defined $implicit property in the context', async(() => { - const template = - ``; + it('should reflect user defined `$implicit` property in the context', async(() => { + const template = `` + + ``; fixture = createTestComponent(template); - - fixture.detectChanges(); - - const refs = fixture.debugElement.children[0].references['refs']; - setTplRef(refs.tplRefs.first); - - fixture.componentInstance.context = {$implicit: fixture.componentInstance.context}; - detectChangesAndExpectText('bar'); + fixture.componentInstance.context = {$implicit: {foo: 'bra'}}; + detectChangesAndExpectText('bra'); })); it('should reflect context re-binding', async(() => { - const template = - ``; + const template = `` + + ``; fixture = createTestComponent(template); - fixture.detectChanges(); - - const refs = fixture.debugElement.children[0].references['refs']; - setTplRef(refs.tplRefs.first); fixture.componentInstance.context = {shawshank: 'brooks'}; - detectChangesAndExpectText('brooks'); fixture.componentInstance.context = {shawshank: 'was here'}; - detectChangesAndExpectText('was here'); })); }); } - @Directive({selector: 'tpl-refs', exportAs: 'tplRefs'}) class CaptureTplRefs { @ContentChildren(TemplateRef) tplRefs: QueryList>; @@ -162,4 +133,4 @@ function createTestComponent(template: string): ComponentFixture return TestBed.overrideComponent(TestComponent, {set: {template: template}}) .configureTestingModule({schemas: [NO_ERRORS_SCHEMA]}) .createComponent(TestComponent); -} \ No newline at end of file +} diff --git a/modules/@angular/core/test/linker/direct_rendering_integration_spec.ts b/modules/@angular/core/test/linker/direct_rendering_integration_spec.ts index 983098feed..00199d496c 100644 --- a/modules/@angular/core/test/linker/direct_rendering_integration_spec.ts +++ b/modules/@angular/core/test/linker/direct_rendering_integration_spec.ts @@ -138,7 +138,7 @@ export function main() { @Component({ selector: 'child', template: - '()' + '()' }) class Child { @Input() diff --git a/modules/@angular/core/test/linker/view_injector_integration_spec.ts b/modules/@angular/core/test/linker/view_injector_integration_spec.ts index 4b6af6281a..20a51d393d 100644 --- a/modules/@angular/core/test/linker/view_injector_integration_spec.ts +++ b/modules/@angular/core/test/linker/view_injector_integration_spec.ts @@ -421,7 +421,7 @@ export function main() { TestBed.overrideDirective( SimpleDirective, {set: {providers: [{provide: 'service', useValue: 'parentService'}]}}); const el = createComponent( - '
    '); + '
    '); expect(el.children[0].children[0].injector.get(NeedsService).service) .toEqual('parentService'); }); diff --git a/modules/@angular/platform-webworker/test/web_workers/worker/renderer_integration_spec.ts b/modules/@angular/platform-webworker/test/web_workers/worker/renderer_integration_spec.ts index 9908dce0b0..5dc4bb383c 100644 --- a/modules/@angular/platform-webworker/test/web_workers/worker/renderer_integration_spec.ts +++ b/modules/@angular/platform-webworker/test/web_workers/worker/renderer_integration_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Component, ComponentRef, Injectable, Injector} from '@angular/core'; +import {Component, ComponentRef, Injectable} from '@angular/core'; import {DebugDomRootRenderer} from '@angular/core/src/debug/debug_renderer'; import {RootRenderer} from '@angular/core/src/render/api'; import {TestBed} from '@angular/core/testing'; @@ -152,7 +152,7 @@ export function main() { it('should update any template comment property/attributes', () => { TestBed.overrideComponent( - MyComp2, {set: {template: ''}}); + MyComp2, {set: {template: ''}}); const fixture = TestBed.createComponent(MyComp2); (fixture.componentInstance).ctxBoolProp = true; @@ -163,7 +163,7 @@ export function main() { it('should add and remove fragments', () => { TestBed.overrideComponent( - MyComp2, {set: {template: ''}}); + MyComp2, {set: {template: 'hello'}}); const fixture = TestBed.createComponent(MyComp2); const rootEl = getRenderElement(fixture.nativeElement);