test(ivy): update root causes for @angular/core TestBed failures (#27370)

PR Close #27370
This commit is contained in:
Pawel Kozlowski 2018-11-30 17:14:53 +01:00 committed by Igor Minar
parent eb17502a7c
commit 1fa5478fef
7 changed files with 715 additions and 752 deletions

View File

@ -135,7 +135,7 @@ class SomeComponent {
describe('ApplicationRef', () => { describe('ApplicationRef', () => {
beforeEach(() => { TestBed.configureTestingModule({imports: [createModule()]}); }); beforeEach(() => { TestBed.configureTestingModule({imports: [createModule()]}); });
fixmeIvy('unknown') && it('should throw when reentering tick', () => { it('should throw when reentering tick', () => {
@Component({template: '{{reenter()}}'}) @Component({template: '{{reenter()}}'})
class ReenteringComponent { class ReenteringComponent {
reenterCount = 1; reenterCount = 1;
@ -185,15 +185,12 @@ class SomeComponent {
}); });
describe('bootstrap', () => { describe('bootstrap', () => {
fixmeIvy('unknown') &&
it('should throw if an APP_INITIIALIZER is not yet resolved', it('should throw if an APP_INITIIALIZER is not yet resolved',
withModule( withModule(
{ {
providers: [{ providers: [
provide: APP_INITIALIZER, {provide: APP_INITIALIZER, useValue: () => new Promise(() => {}), multi: true}
useValue: () => new Promise(() => {}), ]
multi: true
}]
}, },
inject([ApplicationRef], (ref: ApplicationRef) => { inject([ApplicationRef], (ref: ApplicationRef) => {
createRootEl(); createRootEl();
@ -211,7 +208,6 @@ class SomeComponent {
defaultPlatform = _platform; defaultPlatform = _platform;
})); }));
fixmeIvy('unknown') &&
it('should wait for asynchronous app initializers', async(() => { it('should wait for asynchronous app initializers', async(() => {
let resolve: (result: any) => void; let resolve: (result: any) => void;
const promise: Promise<any> = new Promise((res) => { resolve = res; }); const promise: Promise<any> = new Promise((res) => { resolve = res; });
@ -222,18 +218,15 @@ class SomeComponent {
}, 1); }, 1);
defaultPlatform defaultPlatform
.bootstrapModule(createModule( .bootstrapModule(
[{provide: APP_INITIALIZER, useValue: () => promise, multi: true}])) createModule([{provide: APP_INITIALIZER, useValue: () => promise, multi: true}]))
.then(_ => { expect(initializerDone).toBe(true); }); .then(_ => { expect(initializerDone).toBe(true); });
})); }));
fixmeIvy('unknown') && it('should rethrow sync errors even if the exceptionHandler is not rethrowing', async(() => {
it('should rethrow sync errors even if the exceptionHandler is not rethrowing',
async(() => {
defaultPlatform defaultPlatform
.bootstrapModule(createModule([ .bootstrapModule(createModule(
{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true} [{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true}]))
]))
.then(() => expect(false).toBe(true), (e) => { .then(() => expect(false).toBe(true), (e) => {
expect(e).toBe('Test'); expect(e).toBe('Test');
// Error rethrown will be seen by the exception handler since it's after // Error rethrown will be seen by the exception handler since it's after
@ -242,22 +235,18 @@ class SomeComponent {
}); });
})); }));
fixmeIvy('unknown') &&
it('should rethrow promise errors even if the exceptionHandler is not rethrowing', it('should rethrow promise errors even if the exceptionHandler is not rethrowing',
async(() => { async(() => {
defaultPlatform defaultPlatform
.bootstrapModule(createModule([{ .bootstrapModule(createModule([
provide: APP_INITIALIZER, {provide: APP_INITIALIZER, useValue: () => Promise.reject('Test'), multi: true}
useValue: () => Promise.reject('Test'), ]))
multi: true
}]))
.then(() => expect(false).toBe(true), (e) => { .then(() => expect(false).toBe(true), (e) => {
expect(e).toBe('Test'); expect(e).toBe('Test');
expect(mockConsole.res[0].join('#')).toEqual('ERROR#Test'); expect(mockConsole.res[0].join('#')).toEqual('ERROR#Test');
}); });
})); }));
fixmeIvy('unknown') &&
it('should throw useful error when ApplicationRef is not configured', async(() => { it('should throw useful error when ApplicationRef is not configured', async(() => {
@NgModule() @NgModule()
class EmptyModule { class EmptyModule {
@ -270,7 +259,6 @@ class SomeComponent {
}); });
})); }));
fixmeIvy('unknown') &&
it('should call the `ngDoBootstrap` method with `ApplicationRef` on the main module', it('should call the `ngDoBootstrap` method with `ApplicationRef` on the main module',
async(() => { async(() => {
const ngDoBootstrap = jasmine.createSpy('ngDoBootstrap'); const ngDoBootstrap = jasmine.createSpy('ngDoBootstrap');
@ -281,7 +269,6 @@ class SomeComponent {
}); });
})); }));
fixmeIvy('unknown') &&
it('should auto bootstrap components listed in @NgModule.bootstrap', async(() => { it('should auto bootstrap components listed in @NgModule.bootstrap', async(() => {
defaultPlatform.bootstrapModule(createModule({bootstrap: [SomeComponent]})) defaultPlatform.bootstrapModule(createModule({bootstrap: [SomeComponent]}))
.then((moduleRef) => { .then((moduleRef) => {
@ -290,7 +277,6 @@ class SomeComponent {
}); });
})); }));
fixmeIvy('unknown') &&
it('should error if neither `ngDoBootstrap` nor @NgModule.bootstrap was specified', it('should error if neither `ngDoBootstrap` nor @NgModule.bootstrap was specified',
async(() => { async(() => {
defaultPlatform.bootstrapModule(createModule({ngDoBootstrap: false})) defaultPlatform.bootstrapModule(createModule({ngDoBootstrap: false}))
@ -302,13 +288,11 @@ class SomeComponent {
}); });
})); }));
fixmeIvy('unknown') &&
it('should add bootstrapped module into platform modules list', async(() => { it('should add bootstrapped module into platform modules list', async(() => {
defaultPlatform.bootstrapModule(createModule({bootstrap: [SomeComponent]})) defaultPlatform.bootstrapModule(createModule({bootstrap: [SomeComponent]}))
.then(module => expect((<any>defaultPlatform)._modules).toContain(module)); .then(module => expect((<any>defaultPlatform)._modules).toContain(module));
})); }));
fixmeIvy('unknown') &&
it('should bootstrap with NoopNgZone', async(() => { it('should bootstrap with NoopNgZone', async(() => {
defaultPlatform defaultPlatform
.bootstrapModule(createModule({bootstrap: [SomeComponent]}), {ngZone: 'noop'}) .bootstrapModule(createModule({bootstrap: [SomeComponent]}), {ngZone: 'noop'})
@ -325,7 +309,6 @@ class SomeComponent {
createRootEl(); createRootEl();
defaultPlatform = _platform; defaultPlatform = _platform;
})); }));
fixmeIvy('unknown') &&
it('should wait for asynchronous app initializers', async(() => { it('should wait for asynchronous app initializers', async(() => {
let resolve: (result: any) => void; let resolve: (result: any) => void;
const promise: Promise<any> = new Promise((res) => { resolve = res; }); const promise: Promise<any> = new Promise((res) => { resolve = res; });
@ -337,40 +320,30 @@ class SomeComponent {
const compilerFactory: CompilerFactory = const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null); defaultPlatform.injector.get(CompilerFactory, null);
const moduleFactory = const moduleFactory = compilerFactory.createCompiler().compileModuleSync(
compilerFactory.createCompiler().compileModuleSync(createModule( createModule([{provide: APP_INITIALIZER, useValue: () => promise, multi: true}]));
[{provide: APP_INITIALIZER, useValue: () => promise, multi: true}]));
defaultPlatform.bootstrapModuleFactory(moduleFactory).then(_ => { defaultPlatform.bootstrapModuleFactory(moduleFactory).then(_ => {
expect(initializerDone).toBe(true); expect(initializerDone).toBe(true);
}); });
})); }));
fixmeIvy('unknown') && it('should rethrow sync errors even if the exceptionHandler is not rethrowing', async(() => {
it('should rethrow sync errors even if the exceptionHandler is not rethrowing',
async(() => {
const compilerFactory: CompilerFactory = const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null); defaultPlatform.injector.get(CompilerFactory, null);
const moduleFactory = const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
compilerFactory.createCompiler().compileModuleSync(createModule([ [{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true}]));
{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true}
]));
expect(() => defaultPlatform.bootstrapModuleFactory(moduleFactory)).toThrow('Test'); expect(() => defaultPlatform.bootstrapModuleFactory(moduleFactory)).toThrow('Test');
// Error rethrown will be seen by the exception handler since it's after // Error rethrown will be seen by the exception handler since it's after
// construction. // construction.
expect(mockConsole.res[0].join('#')).toEqual('ERROR#Test'); expect(mockConsole.res[0].join('#')).toEqual('ERROR#Test');
})); }));
fixmeIvy('unknown') &&
it('should rethrow promise errors even if the exceptionHandler is not rethrowing', it('should rethrow promise errors even if the exceptionHandler is not rethrowing',
async(() => { async(() => {
const compilerFactory: CompilerFactory = const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null); defaultPlatform.injector.get(CompilerFactory, null);
const moduleFactory = const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
compilerFactory.createCompiler().compileModuleSync(createModule([{ [{provide: APP_INITIALIZER, useValue: () => Promise.reject('Test'), multi: true}]));
provide: APP_INITIALIZER,
useValue: () => Promise.reject('Test'),
multi: true
}]));
defaultPlatform.bootstrapModuleFactory(moduleFactory) defaultPlatform.bootstrapModuleFactory(moduleFactory)
.then(() => expect(false).toBe(true), (e) => { .then(() => expect(false).toBe(true), (e) => {
expect(e).toBe('Test'); expect(e).toBe('Test');
@ -565,20 +538,18 @@ class SomeComponent {
}); });
} }
fixmeIvy('unknown') && it('isStable should fire on synchronous component loading', it('isStable should fire on synchronous component loading',
async(() => { expectStableTexts(SyncComp, ['1']); })); async(() => { expectStableTexts(SyncComp, ['1']); }));
fixmeIvy('unknown') && it('isStable should fire after a microtask on init is completed', it('isStable should fire after a microtask on init is completed',
async(() => { expectStableTexts(MicroTaskComp, ['11']); })); async(() => { expectStableTexts(MicroTaskComp, ['11']); }));
fixmeIvy('unknown') && it('isStable should fire after a macrotask on init is completed', it('isStable should fire after a macrotask on init is completed',
async(() => { expectStableTexts(MacroTaskComp, ['11']); })); async(() => { expectStableTexts(MacroTaskComp, ['11']); }));
fixmeIvy('unknown') &&
it('isStable should fire only after chain of micro and macrotasks on init are completed', it('isStable should fire only after chain of micro and macrotasks on init are completed',
async(() => { expectStableTexts(MicroMacroTaskComp, ['111']); })); async(() => { expectStableTexts(MicroMacroTaskComp, ['111']); }));
fixmeIvy('unknown') &&
it('isStable should fire only after chain of macro and microtasks on init are completed', it('isStable should fire only after chain of macro and microtasks on init are completed',
async(() => { expectStableTexts(MacroMicroTaskComp, ['111']); })); async(() => { expectStableTexts(MacroMicroTaskComp, ['111']); }));
@ -601,7 +572,7 @@ class SomeComponent {
}); });
} }
fixmeIvy('unknown') && it('should be fired after app becomes unstable', async(() => { it('should be fired after app becomes unstable', async(() => {
const fixture = TestBed.createComponent(ClickComp); const fixture = TestBed.createComponent(ClickComp);
const appRef: ApplicationRef = TestBed.get(ApplicationRef); const appRef: ApplicationRef = TestBed.get(ApplicationRef);
const zone: NgZone = TestBed.get(NgZone); const zone: NgZone = TestBed.get(NgZone);

View File

@ -10,7 +10,6 @@ import {Component, Injectable, Input} from '@angular/core';
import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBed, async, withModule} from '@angular/core/testing'; import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBed, async, withModule} from '@angular/core/testing';
import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util'; import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing';
@Component({selector: 'simple-comp', template: `<span>Original {{simpleBinding}}</span>`}) @Component({selector: 'simple-comp', template: `<span>Original {{simpleBinding}}</span>`})
@Injectable() @Injectable()
@ -94,7 +93,7 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') && it('should auto detect changes if autoDetectChanges is called', () => { it('should auto detect changes if autoDetectChanges is called', () => {
const componentFixture = TestBed.createComponent(AutoDetectComp); const componentFixture = TestBed.createComponent(AutoDetectComp);
expect(componentFixture.ngZone).not.toBeNull(); expect(componentFixture.ngZone).not.toBeNull();
@ -108,7 +107,6 @@ class NestedAsyncTimeoutComp {
expect(componentFixture.nativeElement).toHaveText('11'); expect(componentFixture.nativeElement).toHaveText('11');
}); });
fixmeIvy('unknown') &&
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true', it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
withModule({providers: [{provide: ComponentFixtureAutoDetect, useValue: true}]}, () => { withModule({providers: [{provide: ComponentFixtureAutoDetect, useValue: true}]}, () => {
@ -121,7 +119,6 @@ class NestedAsyncTimeoutComp {
expect(componentFixture.nativeElement).toHaveText('11'); expect(componentFixture.nativeElement).toHaveText('11');
})); }));
fixmeIvy('unknown') &&
it('should signal through whenStable when the fixture is stable (autoDetectChanges)', it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
async(() => { async(() => {
const componentFixture = TestBed.createComponent(AsyncComp); const componentFixture = TestBed.createComponent(AsyncComp);
@ -141,7 +138,6 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') &&
it('should signal through isStable when the fixture is stable (no autoDetectChanges)', it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
async(() => { async(() => {
const componentFixture = TestBed.createComponent(AsyncComp); const componentFixture = TestBed.createComponent(AsyncComp);
@ -162,7 +158,6 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') &&
it('should wait for macroTask(setTimeout) while checking for whenStable ' + it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)', '(autoDetectChanges)',
async(() => { async(() => {
@ -183,7 +178,6 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') &&
it('should wait for macroTask(setTimeout) while checking for whenStable ' + it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)', '(no autoDetectChanges)',
async(() => { async(() => {
@ -206,7 +200,6 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') &&
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' + it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)', '(autoDetectChanges)',
async(() => { async(() => {
@ -229,7 +222,6 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') &&
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' + it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)', '(no autoDetectChanges)',
async(() => { async(() => {
@ -252,9 +244,7 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') && it('should stabilize after async task in change detection (autoDetectChanges)', async(() => {
it('should stabilize after async task in change detection (autoDetectChanges)',
async(() => {
const componentFixture = TestBed.createComponent(AsyncChangeComp); const componentFixture = TestBed.createComponent(AsyncChangeComp);
@ -270,9 +260,7 @@ class NestedAsyncTimeoutComp {
}); });
})); }));
fixmeIvy('unknown') && it('should stabilize after async task in change detection(no autoDetectChanges)', async(() => {
it('should stabilize after async task in change detection(no autoDetectChanges)',
async(() => {
const componentFixture = TestBed.createComponent(AsyncChangeComp); const componentFixture = TestBed.createComponent(AsyncChangeComp);
componentFixture.detectChanges(); componentFixture.detectChanges();
@ -301,7 +289,7 @@ class NestedAsyncTimeoutComp {
{providers: [{provide: ComponentFixtureNoNgZone, useValue: true}]}); {providers: [{provide: ComponentFixtureNoNgZone, useValue: true}]});
}); });
fixmeIvy('unknown') && it('calling autoDetectChanges raises an error', () => { it('calling autoDetectChanges raises an error', () => {
const componentFixture = TestBed.createComponent(SimpleComp); const componentFixture = TestBed.createComponent(SimpleComp);
expect(() => { expect(() => {
@ -309,7 +297,6 @@ class NestedAsyncTimeoutComp {
}).toThrowError(/Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set/); }).toThrowError(/Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set/);
}); });
fixmeIvy('unknown') &&
it('should instantiate a component with valid DOM', async(() => { it('should instantiate a component with valid DOM', async(() => {
const componentFixture = TestBed.createComponent(SimpleComp); const componentFixture = TestBed.createComponent(SimpleComp);
@ -319,7 +306,7 @@ class NestedAsyncTimeoutComp {
expect(componentFixture.nativeElement).toHaveText('Original Simple'); expect(componentFixture.nativeElement).toHaveText('Original Simple');
})); }));
fixmeIvy('unknown') && it('should allow changing members of the component', async(() => { it('should allow changing members of the component', async(() => {
const componentFixture = TestBed.createComponent(MyIfComp); const componentFixture = TestBed.createComponent(MyIfComp);

View File

@ -192,13 +192,13 @@ class TestApp {
}); });
})); }));
fixmeIvy('unknown') && it('should list all child nodes', () => { it('should list all child nodes', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
expect(fixture.debugElement.childNodes.length).toEqual(3); expect(fixture.debugElement.childNodes.length).toEqual(3);
}); });
fixmeIvy('unknown') && it('should list all component child elements', () => { it('should list all component child elements', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
const childEls = fixture.debugElement.children; const childEls = fixture.debugElement.children;
@ -225,7 +225,7 @@ class TestApp {
expect(getDOM().hasClass(childNested[0].nativeElement, 'childnested')).toBe(true); expect(getDOM().hasClass(childNested[0].nativeElement, 'childnested')).toBe(true);
}); });
fixmeIvy('unknown') && it('should list conditional component child elements', () => { it('should list conditional component child elements', () => {
fixture = TestBed.createComponent(ConditionalParentComp); fixture = TestBed.createComponent(ConditionalParentComp);
fixture.detectChanges(); fixture.detectChanges();
@ -246,7 +246,7 @@ class TestApp {
expect(conditionalContentComp.children.length).toEqual(1); expect(conditionalContentComp.children.length).toEqual(1);
}); });
fixmeIvy('unknown') && it('should list child elements within viewports', () => { it('should list child elements within viewports', () => {
fixture = TestBed.createComponent(UsingFor); fixture = TestBed.createComponent(UsingFor);
fixture.detectChanges(); fixture.detectChanges();
@ -259,7 +259,8 @@ class TestApp {
expect(list.children.length).toEqual(3); expect(list.children.length).toEqual(3);
}); });
fixmeIvy('unknown') && it('should list element attributes', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should list element attributes', () => {
fixture = TestBed.createComponent(TestApp); fixture = TestBed.createComponent(TestApp);
fixture.detectChanges(); fixture.detectChanges();
const bankElem = fixture.debugElement.children[0]; const bankElem = fixture.debugElement.children[0];
@ -268,7 +269,8 @@ class TestApp {
expect(bankElem.attributes['account']).toEqual('4747'); expect(bankElem.attributes['account']).toEqual('4747');
}); });
fixmeIvy('unknown') && it('should list element classes', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should list element classes', () => {
fixture = TestBed.createComponent(TestApp); fixture = TestBed.createComponent(TestApp);
fixture.detectChanges(); fixture.detectChanges();
const bankElem = fixture.debugElement.children[0]; const bankElem = fixture.debugElement.children[0];
@ -277,7 +279,8 @@ class TestApp {
expect(bankElem.classes['open']).toBe(false); expect(bankElem.classes['open']).toBe(false);
}); });
fixmeIvy('unknown') && it('should list element styles', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should list element styles', () => {
fixture = TestBed.createComponent(TestApp); fixture = TestBed.createComponent(TestApp);
fixture.detectChanges(); fixture.detectChanges();
const bankElem = fixture.debugElement.children[0]; const bankElem = fixture.debugElement.children[0];
@ -286,7 +289,7 @@ class TestApp {
expect(bankElem.styles['color']).toEqual('red'); expect(bankElem.styles['color']).toEqual('red');
}); });
fixmeIvy('unknown') && it('should query child elements by css', () => { it('should query child elements by css', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
@ -296,7 +299,7 @@ class TestApp {
expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true); expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true);
}); });
fixmeIvy('unknown') && it('should query child elements by directive', () => { it('should query child elements by directive', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
@ -309,21 +312,23 @@ class TestApp {
expect(getDOM().hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true); expect(getDOM().hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true);
}); });
fixmeIvy('unknown') && it('should list providerTokens', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should list providerTokens', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
expect(fixture.debugElement.providerTokens).toContain(Logger); expect(fixture.debugElement.providerTokens).toContain(Logger);
}); });
fixmeIvy('unknown') && it('should list locals', () => { it('should list locals', () => {
fixture = TestBed.createComponent(LocalsComp); fixture = TestBed.createComponent(LocalsComp);
fixture.detectChanges(); fixture.detectChanges();
expect(fixture.debugElement.children[0].references !['alice']).toBeAnInstanceOf(MyDir); expect(fixture.debugElement.children[0].references !['alice']).toBeAnInstanceOf(MyDir);
}); });
fixmeIvy('unknown') && it('should allow injecting from the element injector', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should allow injecting from the element injector', () => {
fixture = TestBed.createComponent(ParentComp); fixture = TestBed.createComponent(ParentComp);
fixture.detectChanges(); fixture.detectChanges();
@ -332,7 +337,8 @@ class TestApp {
]); ]);
}); });
fixmeIvy('unknown') && it('should list event listeners', () => { fixmeIvy('FW-719: DebugElement needs proper implementation of its methods.') &&
it('should list event listeners', () => {
fixture = TestBed.createComponent(EventsComp); fixture = TestBed.createComponent(EventsComp);
fixture.detectChanges(); fixture.detectChanges();
@ -341,7 +347,7 @@ class TestApp {
}); });
fixmeIvy('unknown') && it('should trigger event handlers', () => { it('should trigger event handlers', () => {
fixture = TestBed.createComponent(EventsComp); fixture = TestBed.createComponent(EventsComp);
fixture.detectChanges(); fixture.detectChanges();

View File

@ -19,14 +19,14 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
{ {
describe('fake async', () => { describe('fake async', () => {
fixmeIvy('unknown') && it('should run synchronous code', () => { it('should run synchronous code', () => {
let ran = false; let ran = false;
fakeAsync(() => { ran = true; })(); fakeAsync(() => { ran = true; })();
expect(ran).toEqual(true); expect(ran).toEqual(true);
}); });
fixmeIvy('unknown') && it('should pass arguments to the wrapped function', () => { it('should pass arguments to the wrapped function', () => {
fakeAsync((foo: any /** TODO #9100 */, bar: any /** TODO #9100 */) => { fakeAsync((foo: any /** TODO #9100 */, bar: any /** TODO #9100 */) => {
expect(foo).toEqual('foo'); expect(foo).toEqual('foo');
expect(bar).toEqual('bar'); expect(bar).toEqual('bar');
@ -38,13 +38,13 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(parser).toBeAnInstanceOf(Parser); expect(parser).toBeAnInstanceOf(Parser);
}))); })));
fixmeIvy('unknown') && it('should throw on nested calls', () => { it('should throw on nested calls', () => {
expect(() => { expect(() => {
fakeAsync(() => { fakeAsync((): any /** TODO #9100 */ => null)(); })(); fakeAsync(() => { fakeAsync((): any /** TODO #9100 */ => null)(); })();
}).toThrowError('fakeAsync() calls can not be nested'); }).toThrowError('fakeAsync() calls can not be nested');
}); });
fixmeIvy('unknown') && it('should flush microtasks before returning', () => { it('should flush microtasks before returning', () => {
let thenRan = false; let thenRan = false;
fakeAsync(() => { resolvedPromise.then(_ => { thenRan = true; }); })(); fakeAsync(() => { resolvedPromise.then(_ => { thenRan = true; }); })();
@ -53,11 +53,11 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
}); });
fixmeIvy('unknown') && it('should propagate the return value', it('should propagate the return value',
() => { expect(fakeAsync(() => 'foo')()).toEqual('foo'); }); () => { expect(fakeAsync(() => 'foo')()).toEqual('foo'); });
describe('Promise', () => { describe('Promise', () => {
fixmeIvy('unknown') && it('should run asynchronous code', fakeAsync(() => { it('should run asynchronous code', fakeAsync(() => {
let thenRan = false; let thenRan = false;
resolvedPromise.then((_) => { thenRan = true; }); resolvedPromise.then((_) => { thenRan = true; });
@ -67,7 +67,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(thenRan).toEqual(true); expect(thenRan).toEqual(true);
})); }));
fixmeIvy('unknown') && it('should run chained thens', fakeAsync(() => { it('should run chained thens', fakeAsync(() => {
const log = new Log(); const log = new Log();
resolvedPromise.then((_) => log.add(1)).then((_) => log.add(2)); resolvedPromise.then((_) => log.add(1)).then((_) => log.add(2));
@ -78,7 +78,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(log.result()).toEqual('1; 2'); expect(log.result()).toEqual('1; 2');
})); }));
fixmeIvy('unknown') && it('should run Promise created in Promise', fakeAsync(() => { it('should run Promise created in Promise', fakeAsync(() => {
const log = new Log(); const log = new Log();
resolvedPromise.then((_) => { resolvedPromise.then((_) => {
@ -92,7 +92,6 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(log.result()).toEqual('1; 2'); expect(log.result()).toEqual('1; 2');
})); }));
fixmeIvy('unknown') &&
it('should complain if the test throws an exception during async calls', () => { it('should complain if the test throws an exception during async calls', () => {
expect(() => { expect(() => {
fakeAsync(() => { fakeAsync(() => {
@ -102,14 +101,13 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
}).toThrowError(/Uncaught \(in promise\): Error: async/); }).toThrowError(/Uncaught \(in promise\): Error: async/);
}); });
fixmeIvy('unknown') && it('should complain if a test throws an exception', () => { it('should complain if a test throws an exception', () => {
expect(() => { fakeAsync(() => { throw new Error('sync'); })(); }).toThrowError('sync'); expect(() => { fakeAsync(() => { throw new Error('sync'); })(); }).toThrowError('sync');
}); });
}); });
describe('timers', () => { describe('timers', () => {
fixmeIvy('unknown') &&
it('should run queued zero duration timer on zero tick', fakeAsync(() => { it('should run queued zero duration timer on zero tick', fakeAsync(() => {
let ran = false; let ran = false;
setTimeout(() => { ran = true; }, 0); setTimeout(() => { ran = true; }, 0);
@ -121,7 +119,6 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
})); }));
fixmeIvy('unknown') &&
it('should run queued timer after sufficient clock ticks', fakeAsync(() => { it('should run queued timer after sufficient clock ticks', fakeAsync(() => {
let ran = false; let ran = false;
setTimeout(() => { ran = true; }, 10); setTimeout(() => { ran = true; }, 10);
@ -133,7 +130,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(ran).toEqual(true); expect(ran).toEqual(true);
})); }));
fixmeIvy('unknown') && it('should run queued timer only once', fakeAsync(() => { it('should run queued timer only once', fakeAsync(() => {
let cycles = 0; let cycles = 0;
setTimeout(() => { cycles++; }, 10); setTimeout(() => { cycles++; }, 10);
@ -147,7 +144,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(cycles).toEqual(1); expect(cycles).toEqual(1);
})); }));
fixmeIvy('unknown') && it('should not run cancelled timer', fakeAsync(() => { it('should not run cancelled timer', fakeAsync(() => {
let ran = false; let ran = false;
const id = setTimeout(() => { ran = true; }, 10); const id = setTimeout(() => { ran = true; }, 10);
clearTimeout(id); clearTimeout(id);
@ -156,19 +153,19 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(ran).toEqual(false); expect(ran).toEqual(false);
})); }));
fixmeIvy('unknown') && it('should throw an error on dangling timers', () => { it('should throw an error on dangling timers', () => {
expect(() => { expect(() => {
fakeAsync(() => { setTimeout(() => {}, 10); })(); fakeAsync(() => { setTimeout(() => {}, 10); })();
}).toThrowError('1 timer(s) still in the queue.'); }).toThrowError('1 timer(s) still in the queue.');
}); });
fixmeIvy('unknown') && it('should throw an error on dangling periodic timers', () => { it('should throw an error on dangling periodic timers', () => {
expect(() => { expect(() => {
fakeAsync(() => { setInterval(() => {}, 10); })(); fakeAsync(() => { setInterval(() => {}, 10); })();
}).toThrowError('1 periodic timer(s) still in the queue.'); }).toThrowError('1 periodic timer(s) still in the queue.');
}); });
fixmeIvy('unknown') && it('should run periodic timers', fakeAsync(() => { it('should run periodic timers', fakeAsync(() => {
let cycles = 0; let cycles = 0;
const id = setInterval(() => { cycles++; }, 10); const id = setInterval(() => { cycles++; }, 10);
@ -183,7 +180,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
clearInterval(id); clearInterval(id);
})); }));
fixmeIvy('unknown') && it('should not run cancelled periodic timer', fakeAsync(() => { it('should not run cancelled periodic timer', fakeAsync(() => {
let ran = false; let ran = false;
const id = setInterval(() => { ran = true; }, 10); const id = setInterval(() => { ran = true; }, 10);
clearInterval(id); clearInterval(id);
@ -192,7 +189,6 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(ran).toEqual(false); expect(ran).toEqual(false);
})); }));
fixmeIvy('unknown') &&
it('should be able to cancel periodic timers from a callback', fakeAsync(() => { it('should be able to cancel periodic timers from a callback', fakeAsync(() => {
let cycles = 0; let cycles = 0;
let id: any /** TODO #9100 */; let id: any /** TODO #9100 */;
@ -209,7 +205,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(cycles).toEqual(1); expect(cycles).toEqual(1);
})); }));
fixmeIvy('unknown') && it('should clear periodic timers', fakeAsync(() => { it('should clear periodic timers', fakeAsync(() => {
let cycles = 0; let cycles = 0;
const id = setInterval(() => { cycles++; }, 10); const id = setInterval(() => { cycles++; }, 10);
@ -227,7 +223,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(cycles).toEqual(2); expect(cycles).toEqual(2);
})); }));
fixmeIvy('unknown') && it('should process microtasks before timers', fakeAsync(() => { it('should process microtasks before timers', fakeAsync(() => {
const log = new Log(); const log = new Log();
resolvedPromise.then((_) => log.add('microtask')); resolvedPromise.then((_) => log.add('microtask'));
@ -243,7 +239,6 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
clearInterval(id); clearInterval(id);
})); }));
fixmeIvy('unknown') &&
it('should process micro-tasks created in timers before next timers', fakeAsync(() => { it('should process micro-tasks created in timers before next timers', fakeAsync(() => {
const log = new Log(); const log = new Log();
@ -270,7 +265,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
clearInterval(id); clearInterval(id);
})); }));
fixmeIvy('unknown') && it('should flush tasks', fakeAsync(() => { it('should flush tasks', fakeAsync(() => {
let ran = false; let ran = false;
setTimeout(() => { ran = true; }, 10); setTimeout(() => { ran = true; }, 10);
@ -278,7 +273,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(ran).toEqual(true); expect(ran).toEqual(true);
})); }));
fixmeIvy('unknown') && it('should flush multiple tasks', fakeAsync(() => { it('should flush multiple tasks', fakeAsync(() => {
let ran = false; let ran = false;
let ran2 = false; let ran2 = false;
setTimeout(() => { ran = true; }, 10); setTimeout(() => { ran = true; }, 10);
@ -291,7 +286,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
expect(elapsed).toEqual(30); expect(elapsed).toEqual(30);
})); }));
fixmeIvy('unknown') && it('should move periodic tasks', fakeAsync(() => { it('should move periodic tasks', fakeAsync(() => {
let ran = false; let ran = false;
let count = 0; let count = 0;
setInterval(() => { count++; }, 10); setInterval(() => { count++; }, 10);
@ -308,25 +303,25 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
}); });
describe('outside of the fakeAsync zone', () => { describe('outside of the fakeAsync zone', () => {
fixmeIvy('unknown') && it('calling flushMicrotasks should throw', () => { it('calling flushMicrotasks should throw', () => {
expect(() => { expect(() => {
flushMicrotasks(); flushMicrotasks();
}).toThrowError('The code should be running in the fakeAsync zone to call this function'); }).toThrowError('The code should be running in the fakeAsync zone to call this function');
}); });
fixmeIvy('unknown') && it('calling tick should throw', () => { it('calling tick should throw', () => {
expect(() => { expect(() => {
tick(); tick();
}).toThrowError('The code should be running in the fakeAsync zone to call this function'); }).toThrowError('The code should be running in the fakeAsync zone to call this function');
}); });
fixmeIvy('unknown') && it('calling flush should throw', () => { it('calling flush should throw', () => {
expect(() => { expect(() => {
flush(); flush();
}).toThrowError('The code should be running in the fakeAsync zone to call this function'); }).toThrowError('The code should be running in the fakeAsync zone to call this function');
}); });
fixmeIvy('unknown') && it('calling discardPeriodicTasks should throw', () => { it('calling discardPeriodicTasks should throw', () => {
expect(() => { expect(() => {
discardPeriodicTasks(); discardPeriodicTasks();
}).toThrowError('The code should be running in the fakeAsync zone to call this function'); }).toThrowError('The code should be running in the fakeAsync zone to call this function');
@ -338,7 +333,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
let zoneInTest1: Zone; let zoneInTest1: Zone;
beforeEach(fakeAsync(() => { zoneInBeforeEach = Zone.current; })); beforeEach(fakeAsync(() => { zoneInBeforeEach = Zone.current; }));
fixmeIvy('unknown') && it('should use the same zone as in beforeEach', fakeAsync(() => { it('should use the same zone as in beforeEach', fakeAsync(() => {
zoneInTest1 = Zone.current; zoneInTest1 = Zone.current;
expect(zoneInTest1).toBe(zoneInBeforeEach); expect(zoneInTest1).toBe(zoneInBeforeEach);
})); }));
@ -350,9 +345,7 @@ const ProxyZoneSpec: {assertPresent: () => void} = (Zone as any)['ProxyZoneSpec'
afterEach(() => { ProxyZoneSpec.assertPresent(); }); afterEach(() => { ProxyZoneSpec.assertPresent(); });
fixmeIvy('unknown') && it('should allow fakeAsync zone to retroactively set a zoneSpec outside of fakeAsync', () => {
it('should allow fakeAsync zone to retroactively set a zoneSpec outside of fakeAsync',
() => {
ProxyZoneSpec.assertPresent(); ProxyZoneSpec.assertPresent();
let state: string = 'not run'; let state: string = 'not run';
const testZone = Zone.current.fork({name: 'test-zone'}); const testZone = Zone.current.fork({name: 'test-zone'});

View File

@ -22,7 +22,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {dispatchEvent, el} from '@angular/platform-browser/testing/src/browser_util'; import {dispatchEvent, el} from '@angular/platform-browser/testing/src/browser_util';
import {expect} from '@angular/platform-browser/testing/src/matchers'; import {expect} from '@angular/platform-browser/testing/src/matchers';
import {fixmeIvy} from '@angular/private/testing'; import {fixmeIvy, modifiedInIvy} from '@angular/private/testing';
import {stringify} from '../../src/util'; import {stringify} from '../../src/util';
@ -209,7 +209,8 @@ function declareTests(config?: {useJit: boolean}) {
.toEqual('Some other <div>HTML</div>'); .toEqual('Some other <div>HTML</div>');
}); });
fixmeIvy('unknown') && it('should consume binding to className using class alias', () => { modifiedInIvy('Binding to the class property directly works differently') &&
it('should consume binding to className using class alias', () => {
TestBed.configureTestingModule({declarations: [MyComp]}); TestBed.configureTestingModule({declarations: [MyComp]});
const template = '<div class="initial" [class]="ctxProp"></div>'; const template = '<div class="initial" [class]="ctxProp"></div>';
TestBed.overrideComponent(MyComp, {set: {template}}); TestBed.overrideComponent(MyComp, {set: {template}});
@ -373,7 +374,7 @@ function declareTests(config?: {useJit: boolean}) {
const fixture = TestBed.createComponent(MyComp); const fixture = TestBed.createComponent(MyComp);
}); });
fixmeIvy('FW-678: ivy generates different DOM structure for <ng-container>') && modifiedInIvy('Comment node order changed') &&
it('should support template directives via `<ng-template>` elements.', () => { it('should support template directives via `<ng-template>` elements.', () => {
TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]}); TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]});
const template = const template =
@ -401,7 +402,8 @@ function declareTests(config?: {useJit: boolean}) {
expect(fixture.nativeElement).toHaveText('baz'); expect(fixture.nativeElement).toHaveText('baz');
}); });
fixmeIvy('unknown') && fixmeIvy(
'FW-665: Discovery util fails with "Unable to find the given context data for the given target"') &&
it('should not detach views in ViewContainers when the parent view is destroyed.', () => { it('should not detach views in ViewContainers when the parent view is destroyed.', () => {
TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]}); TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]});
const template = const template =
@ -565,7 +567,7 @@ function declareTests(config?: {useJit: boolean}) {
}); });
describe('variables', () => { describe('variables', () => {
fixmeIvy('FW-678: ivy generates different DOM structure for <ng-container>') && modifiedInIvy('Comment node order changed') &&
it('should allow to use variables in a for loop', () => { it('should allow to use variables in a for loop', () => {
const template = const template =
'<ng-template ngFor [ngForOf]="[1]" let-i><child-cmp-no-template #cmp></child-cmp-no-template>{{i}}-{{cmp.ctxProp}}</ng-template>'; '<ng-template ngFor [ngForOf]="[1]" let-i><child-cmp-no-template #cmp></child-cmp-no-template>{{i}}-{{cmp.ctxProp}}</ng-template>';
@ -583,7 +585,8 @@ function declareTests(config?: {useJit: boolean}) {
describe('OnPush components', () => { describe('OnPush components', () => {
fixmeIvy('unknown') && fixmeIvy(
'FW-764: fixture.detectChanges() is not respecting OnPush flag on components in the root template') &&
it('should use ChangeDetectorRef to manually request a check', () => { it('should use ChangeDetectorRef to manually request a check', () => {
TestBed.configureTestingModule({declarations: [MyComp, [[PushCmpWithRef]]]}); TestBed.configureTestingModule({declarations: [MyComp, [[PushCmpWithRef]]]});
const template = '<push-cmp-with-ref #cmp></push-cmp-with-ref>'; const template = '<push-cmp-with-ref #cmp></push-cmp-with-ref>';
@ -604,7 +607,9 @@ function declareTests(config?: {useJit: boolean}) {
expect(cmp.numberOfChecks).toEqual(2); expect(cmp.numberOfChecks).toEqual(2);
}); });
fixmeIvy('unknown') && it('should be checked when its bindings got updated', () => { fixmeIvy(
'FW-764: fixture.detectChanges() is not respecting OnPush flag on components in the root template') &&
it('should be checked when its bindings got updated', () => {
TestBed.configureTestingModule( TestBed.configureTestingModule(
{declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]}); {declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]});
const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>'; const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>';
@ -643,7 +648,8 @@ function declareTests(config?: {useJit: boolean}) {
})); }));
} }
fixmeIvy('unknown') && it('should be checked when an event is fired', () => { fixmeIvy('FW-758: OnPush events not marking view dirty when using renderer2') &&
it('should be checked when an event is fired', () => {
TestBed.configureTestingModule( TestBed.configureTestingModule(
{declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]}); {declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]});
const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>'; const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>';
@ -767,7 +773,8 @@ function declareTests(config?: {useJit: boolean}) {
expect(childComponent.myHost).toBeAnInstanceOf(SomeDirective); expect(childComponent.myHost).toBeAnInstanceOf(SomeDirective);
}); });
fixmeIvy('unknown') && fixmeIvy(
'FW-763: LView tree not properly constructed / destroyed for dynamically inserted components') &&
it('should support events via EventEmitter on regular elements', async(() => { it('should support events via EventEmitter on regular elements', async(() => {
TestBed.configureTestingModule( TestBed.configureTestingModule(
{declarations: [MyComp, DirectiveEmittingEvent, DirectiveListeningEvent]}); {declarations: [MyComp, DirectiveEmittingEvent, DirectiveListeningEvent]});
@ -1490,7 +1497,7 @@ function declareTests(config?: {useJit: boolean}) {
}); });
describe('error handling', () => { describe('error handling', () => {
fixmeIvy('unknown') && fixmeIvy('FW-682: TestBed: tests assert that compilation produces specific error') &&
it('should report a meaningful error when a directive is missing annotation', () => { it('should report a meaningful error when a directive is missing annotation', () => {
TestBed.configureTestingModule( TestBed.configureTestingModule(
{declarations: [MyComp, SomeDirectiveMissingAnnotation]}); {declarations: [MyComp, SomeDirectiveMissingAnnotation]});
@ -1500,7 +1507,7 @@ function declareTests(config?: {useJit: boolean}) {
`Unexpected value '${stringify(SomeDirectiveMissingAnnotation)}' declared by the module 'DynamicTestModule'. Please add a @Pipe/@Directive/@Component annotation.`); `Unexpected value '${stringify(SomeDirectiveMissingAnnotation)}' declared by the module 'DynamicTestModule'. Please add a @Pipe/@Directive/@Component annotation.`);
}); });
fixmeIvy('unknown') && fixmeIvy('FW-682: TestBed: tests assert that compilation produces specific error') &&
it('should report a meaningful error when a component is missing view annotation', () => { it('should report a meaningful error when a component is missing view annotation', () => {
TestBed.configureTestingModule({declarations: [MyComp, ComponentWithoutView]}); TestBed.configureTestingModule({declarations: [MyComp, ComponentWithoutView]});
try { try {
@ -1722,7 +1729,9 @@ function declareTests(config?: {useJit: boolean}) {
.toContain('"ng\-reflect\-ng\-if"\: "true"'); .toContain('"ng\-reflect\-ng\-if"\: "true"');
}); });
fixmeIvy('unknown') && it('should indicate when toString() throws', () => { // also affected by FW-587: Inputs with aliases in component decorators don't work
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
it('should indicate when toString() throws', () => {
TestBed.configureTestingModule({declarations: [MyComp, MyDir]}); TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
const template = '<div my-dir [elprop]="toStringThrow"></div>'; const template = '<div my-dir [elprop]="toStringThrow"></div>';
TestBed.overrideComponent(MyComp, {set: {template}}); TestBed.overrideComponent(MyComp, {set: {template}});

View File

@ -116,7 +116,7 @@ describe('TestBed', () => {
expect(nameInjected).toEqual('World!'); expect(nameInjected).toEqual('World!');
}); });
fixmeIvy('unknown') && it('should give access to the node injector for root node', () => { it('should give access to the node injector for root node', () => {
const hello = TestBed.createComponent(HelloWorld); const hello = TestBed.createComponent(HelloWorld);
hello.detectChanges(); hello.detectChanges();
const injector = hello.debugElement.injector; const injector = hello.debugElement.injector;

View File

@ -117,7 +117,7 @@ import {fixmeIvy} from '@angular/private/testing';
describe('deps', () => { describe('deps', () => {
class Dep {} class Dep {}
fixmeIvy('unknown') && it('should inject deps from the same element', () => { it('should inject deps from the same element', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 2, 'span'), elementDef(0, NodeFlags.None, null, null, 2, 'span'),
directiveDef(1, NodeFlags.None, null, 0, Dep, []), directiveDef(1, NodeFlags.None, null, 0, Dep, []),
@ -127,7 +127,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep instanceof Dep).toBeTruthy(); expect(instance.dep instanceof Dep).toBeTruthy();
}); });
fixmeIvy('unknown') && it('should inject deps from a parent element', () => { it('should inject deps from a parent element', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 3, 'span'), elementDef(0, NodeFlags.None, null, null, 3, 'span'),
directiveDef(1, NodeFlags.None, null, 0, Dep, []), directiveDef(1, NodeFlags.None, null, 0, Dep, []),
@ -167,7 +167,7 @@ import {fixmeIvy} from '@angular/private/testing';
' NullInjectorError: No provider for Dep!'); ' NullInjectorError: No provider for Dep!');
}); });
fixmeIvy('unknown') && it('should inject from a parent element in a parent view', () => { it('should inject from a parent element in a parent view', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef( elementDef(
0, NodeFlags.None, null, null, 1, 'div', null, null, null, null, 0, NodeFlags.None, null, null, 1, 'div', null, null, null, null,
@ -192,7 +192,7 @@ import {fixmeIvy} from '@angular/private/testing';
' NullInjectorError: No provider for nonExistingDep!'); ' NullInjectorError: No provider for nonExistingDep!');
}); });
fixmeIvy('unknown') && it('should use null for optional missing dependencies', () => { it('should use null for optional missing dependencies', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 1, 'span'), elementDef(0, NodeFlags.None, null, null, 1, 'span'),
directiveDef( directiveDef(
@ -202,7 +202,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep).toBe(null); expect(instance.dep).toBe(null);
}); });
fixmeIvy('unknown') && it('should skip the current element when using SkipSelf', () => { it('should skip the current element when using SkipSelf', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 4, 'span'), elementDef(0, NodeFlags.None, null, null, 4, 'span'),
providerDef(NodeFlags.TypeValueProvider, null, 'someToken', 'someParentValue', []), providerDef(NodeFlags.TypeValueProvider, null, 'someToken', 'someParentValue', []),
@ -214,7 +214,6 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep).toBe('someParentValue'); expect(instance.dep).toBe('someParentValue');
}); });
fixmeIvy('unknown') &&
it('should ask the root injector', it('should ask the root injector',
withModule({providers: [{provide: 'rootDep', useValue: 'rootValue'}]}, () => { withModule({providers: [{provide: 'rootDep', useValue: 'rootValue'}]}, () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
@ -226,7 +225,7 @@ import {fixmeIvy} from '@angular/private/testing';
})); }));
describe('builtin tokens', () => { describe('builtin tokens', () => {
fixmeIvy('unknown') && it('should inject ViewContainerRef', () => { it('should inject ViewContainerRef', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
anchorDef(NodeFlags.EmbeddedViews, null, null, 1), anchorDef(NodeFlags.EmbeddedViews, null, null, 1),
directiveDef(1, NodeFlags.None, null, 0, SomeService, [ViewContainerRef]), directiveDef(1, NodeFlags.None, null, 0, SomeService, [ViewContainerRef]),
@ -235,7 +234,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep.createEmbeddedView).toBeTruthy(); expect(instance.dep.createEmbeddedView).toBeTruthy();
}); });
fixmeIvy('unknown') && it('should inject TemplateRef', () => { it('should inject TemplateRef', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
anchorDef(NodeFlags.None, null, null, 1, null, compViewDefFactory([anchorDef( anchorDef(NodeFlags.None, null, null, 1, null, compViewDefFactory([anchorDef(
NodeFlags.None, null, null, 0)])), NodeFlags.None, null, null, 0)])),
@ -245,7 +244,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep.createEmbeddedView).toBeTruthy(); expect(instance.dep.createEmbeddedView).toBeTruthy();
}); });
fixmeIvy('unknown') && it('should inject ElementRef', () => { it('should inject ElementRef', () => {
const {view} = createAndGetRootNodes(compViewDef([ const {view} = createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 1, 'span'), elementDef(0, NodeFlags.None, null, null, 1, 'span'),
directiveDef(1, NodeFlags.None, null, 0, SomeService, [ElementRef]), directiveDef(1, NodeFlags.None, null, 0, SomeService, [ElementRef]),
@ -254,7 +253,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep.nativeElement).toBe(asElementData(view, 0).renderElement); expect(instance.dep.nativeElement).toBe(asElementData(view, 0).renderElement);
}); });
fixmeIvy('unknown') && it('should inject Injector', () => { it('should inject Injector', () => {
const {view} = createAndGetRootNodes(compViewDef([ const {view} = createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 1, 'span'), elementDef(0, NodeFlags.None, null, null, 1, 'span'),
directiveDef(1, NodeFlags.None, null, 0, SomeService, [Injector]), directiveDef(1, NodeFlags.None, null, 0, SomeService, [Injector]),
@ -263,7 +262,6 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep.get(SomeService)).toBe(instance); expect(instance.dep.get(SomeService)).toBe(instance);
}); });
fixmeIvy('unknown') &&
it('should inject ChangeDetectorRef for non component providers', () => { it('should inject ChangeDetectorRef for non component providers', () => {
const {view} = createAndGetRootNodes(compViewDef([ const {view} = createAndGetRootNodes(compViewDef([
elementDef(0, NodeFlags.None, null, null, 1, 'span'), elementDef(0, NodeFlags.None, null, null, 1, 'span'),
@ -273,7 +271,6 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep._view).toBe(view); expect(instance.dep._view).toBe(view);
}); });
fixmeIvy('unknown') &&
it('should inject ChangeDetectorRef for component providers', () => { it('should inject ChangeDetectorRef for component providers', () => {
const {view, rootNodes} = createAndGetRootNodes(compViewDef([ const {view, rootNodes} = createAndGetRootNodes(compViewDef([
elementDef( elementDef(
@ -288,7 +285,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep._view).toBe(compView); expect(instance.dep._view).toBe(compView);
}); });
fixmeIvy('unknown') && it('should inject RendererV1', () => { it('should inject RendererV1', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef( elementDef(
0, NodeFlags.None, null, null, 1, 'span', null, null, null, null, 0, NodeFlags.None, null, null, 1, 'span', null, null, null, null,
@ -299,7 +296,7 @@ import {fixmeIvy} from '@angular/private/testing';
expect(instance.dep.createElement).toBeTruthy(); expect(instance.dep.createElement).toBeTruthy();
}); });
fixmeIvy('unknown') && it('should inject Renderer2', () => { it('should inject Renderer2', () => {
createAndGetRootNodes(compViewDef([ createAndGetRootNodes(compViewDef([
elementDef( elementDef(
0, NodeFlags.None, null, null, 1, 'span', null, null, null, null, 0, NodeFlags.None, null, null, 1, 'span', null, null, null, null,