test(ivy): root cause analysis for platform-browser (#27460)
PR Close #27460
This commit is contained in:
parent
c07afd9db1
commit
9062b391a2
|
@ -160,7 +160,7 @@ function bootstrap(
|
||||||
|
|
||||||
afterEach(destroyPlatform);
|
afterEach(destroyPlatform);
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-553: TestBed is unaware of async compilation') &&
|
||||||
it('should throw if bootstrapped Directive is not a Component',
|
it('should throw if bootstrapped Directive is not a Component',
|
||||||
inject([AsyncTestCompleter], (done: AsyncTestCompleter) => {
|
inject([AsyncTestCompleter], (done: AsyncTestCompleter) => {
|
||||||
const logger = new MockConsole();
|
const logger = new MockConsole();
|
||||||
|
@ -188,7 +188,7 @@ function bootstrap(
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-553: TestBed is unaware of async compilation') &&
|
||||||
it('should throw if no provider',
|
it('should throw if no provider',
|
||||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
const logger = new MockConsole();
|
const logger = new MockConsole();
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {CompilerConfig, ResourceLoader} from '@angular/compiler';
|
||||||
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, Directive, Inject, Injectable, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, Directive, Inject, Injectable, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
||||||
import {TestBed, async, fakeAsync, getTestBed, inject, tick, withModule} from '@angular/core/testing';
|
import {TestBed, async, fakeAsync, getTestBed, inject, tick, withModule} from '@angular/core/testing';
|
||||||
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, obsoleteInIvy} from '@angular/private/testing';
|
||||||
|
|
||||||
// Services, and components for the tests.
|
// Services, and components for the tests.
|
||||||
|
|
||||||
|
@ -251,13 +251,14 @@ class CompWithUrlTemplate {
|
||||||
expect(compFixture.componentInstance).toBeAnInstanceOf(CompUsingModuleDirectiveAndPipe);
|
expect(compFixture.componentInstance).toBeAnInstanceOf(CompUsingModuleDirectiveAndPipe);
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should use set up directives and pipes', () => {
|
fixmeIvy('FW-681: not possible to retrieve host property bindings from TView') &&
|
||||||
const compFixture = TestBed.createComponent(CompUsingModuleDirectiveAndPipe);
|
it('should use set up directives and pipes', () => {
|
||||||
const el = compFixture.debugElement;
|
const compFixture = TestBed.createComponent(CompUsingModuleDirectiveAndPipe);
|
||||||
|
const el = compFixture.debugElement;
|
||||||
|
|
||||||
compFixture.detectChanges();
|
compFixture.detectChanges();
|
||||||
expect(el.children[0].properties['title']).toBe('transformed someValue');
|
expect(el.children[0].properties['title']).toBe('transformed someValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use set up imported modules',
|
it('should use set up imported modules',
|
||||||
inject([SomeLibModule], (libModule: SomeLibModule) => {
|
inject([SomeLibModule], (libModule: SomeLibModule) => {
|
||||||
|
@ -288,7 +289,7 @@ class CompWithUrlTemplate {
|
||||||
expect(service.value).toEqual('real value');
|
expect(service.value).toEqual('real value');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-681: not possible to retrieve host property bindings from TView') &&
|
||||||
it('should use set up directives and pipes', withModule(moduleConfig, () => {
|
it('should use set up directives and pipes', withModule(moduleConfig, () => {
|
||||||
const compFixture = TestBed.createComponent(CompUsingModuleDirectiveAndPipe);
|
const compFixture = TestBed.createComponent(CompUsingModuleDirectiveAndPipe);
|
||||||
const el = compFixture.debugElement;
|
const el = compFixture.debugElement;
|
||||||
|
@ -309,7 +310,7 @@ class CompWithUrlTemplate {
|
||||||
TestBed.compileComponents();
|
TestBed.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fixmeIvy('unknown') && isBrowser &&
|
fixmeIvy('FW-553: TestBed is unaware of async compilation') && isBrowser &&
|
||||||
it('should allow to createSync components with templateUrl after explicit async compilation',
|
it('should allow to createSync components with templateUrl after explicit async compilation',
|
||||||
() => {
|
() => {
|
||||||
const fixture = TestBed.createComponent(CompWithUrlTemplate);
|
const fixture = TestBed.createComponent(CompWithUrlTemplate);
|
||||||
|
@ -370,11 +371,12 @@ class CompWithUrlTemplate {
|
||||||
.overrideDirective(
|
.overrideDirective(
|
||||||
SomeDirective, {set: {selector: '[someDir]', host: {'[title]': 'someProp'}}});
|
SomeDirective, {set: {selector: '[someDir]', host: {'[title]': 'someProp'}}});
|
||||||
});
|
});
|
||||||
fixmeIvy('unknown') && it('should work', () => {
|
fixmeIvy('FW-681: not possible to retrieve host property bindings from TView') &&
|
||||||
const compFixture = TestBed.createComponent(SomeComponent);
|
it('should work', () => {
|
||||||
compFixture.detectChanges();
|
const compFixture = TestBed.createComponent(SomeComponent);
|
||||||
expect(compFixture.debugElement.children[0].properties['title']).toEqual('hello');
|
compFixture.detectChanges();
|
||||||
});
|
expect(compFixture.debugElement.children[0].properties['title']).toEqual('hello');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('pipe', () => {
|
describe('pipe', () => {
|
||||||
|
@ -385,11 +387,12 @@ class CompWithUrlTemplate {
|
||||||
.overridePipe(SomePipe, {set: {name: 'somePipe'}})
|
.overridePipe(SomePipe, {set: {name: 'somePipe'}})
|
||||||
.overridePipe(SomePipe, {add: {pure: false}});
|
.overridePipe(SomePipe, {add: {pure: false}});
|
||||||
});
|
});
|
||||||
fixmeIvy('unknown') && it('should work', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
const compFixture = TestBed.createComponent(SomeComponent);
|
it('should work', () => {
|
||||||
compFixture.detectChanges();
|
const compFixture = TestBed.createComponent(SomeComponent);
|
||||||
expect(compFixture.nativeElement).toHaveText('transformed hello');
|
compFixture.detectChanges();
|
||||||
});
|
expect(compFixture.nativeElement).toHaveText('transformed hello');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('template', () => {
|
describe('template', () => {
|
||||||
|
@ -455,25 +458,28 @@ class CompWithUrlTemplate {
|
||||||
expect(TestBed.get('a')).toBe('mockA: depValue');
|
expect(TestBed.get('a')).toBe('mockA: depValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support SkipSelf', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@NgModule({
|
it('should support SkipSelf', () => {
|
||||||
providers: [
|
@NgModule({
|
||||||
{provide: 'a', useValue: 'aValue'},
|
providers: [
|
||||||
{provide: 'dep', useValue: 'depValue'},
|
{provide: 'a', useValue: 'aValue'},
|
||||||
]
|
{provide: 'dep', useValue: 'depValue'},
|
||||||
})
|
]
|
||||||
class MyModule {
|
})
|
||||||
}
|
class MyModule {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
'a',
|
||||||
TestBed.configureTestingModule(
|
{useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||||
{providers: [{provide: 'dep', useValue: 'parentDepValue'}]});
|
TestBed.configureTestingModule(
|
||||||
|
{providers: [{provide: 'dep', useValue: 'parentDepValue'}]});
|
||||||
|
|
||||||
const compiler = TestBed.get(Compiler) as Compiler;
|
const compiler = TestBed.get(Compiler) as Compiler;
|
||||||
const modFactory = compiler.compileModuleSync(MyModule);
|
const modFactory = compiler.compileModuleSync(MyModule);
|
||||||
expect(modFactory.create(getTestBed()).injector.get('a')).toBe('mockA: parentDepValue');
|
expect(modFactory.create(getTestBed()).injector.get('a'))
|
||||||
});
|
.toBe('mockA: parentDepValue');
|
||||||
|
});
|
||||||
|
|
||||||
it('should keep imported NgModules eager', () => {
|
it('should keep imported NgModules eager', () => {
|
||||||
let someModule: SomeModule|undefined;
|
let someModule: SomeModule|undefined;
|
||||||
|
@ -495,7 +501,7 @@ class CompWithUrlTemplate {
|
||||||
expect(someModule).toBeAnInstanceOf(SomeModule);
|
expect(someModule).toBeAnInstanceOf(SomeModule);
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
obsoleteInIvy(`deprecated method, won't be reimplemented for Render3`) &&
|
||||||
it('should keep imported NgModules lazy with deprecatedOverrideProvider', () => {
|
it('should keep imported NgModules lazy with deprecatedOverrideProvider', () => {
|
||||||
let someModule: SomeModule|undefined;
|
let someModule: SomeModule|undefined;
|
||||||
|
|
||||||
|
@ -547,137 +553,147 @@ class CompWithUrlTemplate {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('in Components', () => {
|
describe('in Components', () => {
|
||||||
fixmeIvy('unknown') && it('should support useValue', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Component({
|
it('should support useValue', () => {
|
||||||
template: '',
|
@Component({
|
||||||
providers: [
|
template: '',
|
||||||
{provide: 'a', useValue: 'aValue'},
|
providers: [
|
||||||
]
|
{provide: 'a', useValue: 'aValue'},
|
||||||
})
|
]
|
||||||
class MComp {
|
})
|
||||||
}
|
class MComp {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
TestBed.overrideProvider('a', {useValue: 'mockValue'});
|
||||||
const ctx =
|
const ctx =
|
||||||
TestBed.configureTestingModule({declarations: [MComp]}).createComponent(MComp);
|
TestBed.configureTestingModule({declarations: [MComp]}).createComponent(MComp);
|
||||||
|
|
||||||
expect(ctx.debugElement.injector.get('a')).toBe('mockValue');
|
expect(ctx.debugElement.injector.get('a')).toBe('mockValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support useFactory', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Component({
|
it('should support useFactory', () => {
|
||||||
template: '',
|
@Component({
|
||||||
providers: [
|
template: '',
|
||||||
{provide: 'dep', useValue: 'depValue'},
|
providers: [
|
||||||
{provide: 'a', useValue: 'aValue'},
|
{provide: 'dep', useValue: 'depValue'},
|
||||||
]
|
{provide: 'a', useValue: 'aValue'},
|
||||||
})
|
]
|
||||||
class MyComp {
|
})
|
||||||
}
|
class MyComp {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: ['dep']});
|
||||||
const ctx =
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp]})
|
||||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
.createComponent(MyComp);
|
||||||
|
|
||||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support @Optional without matches', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Component({
|
it('should support @Optional without matches', () => {
|
||||||
template: '',
|
@Component({
|
||||||
providers: [
|
template: '',
|
||||||
{provide: 'a', useValue: 'aValue'},
|
providers: [
|
||||||
]
|
{provide: 'a', useValue: 'aValue'},
|
||||||
})
|
]
|
||||||
class MyComp {
|
})
|
||||||
}
|
class MyComp {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
'a',
|
||||||
const ctx =
|
{useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp]})
|
||||||
|
.createComponent(MyComp);
|
||||||
|
|
||||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: null');
|
expect(ctx.debugElement.injector.get('a')).toBe('mockA: null');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support Optional with matches', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Component({
|
it('should support Optional with matches', () => {
|
||||||
template: '',
|
@Component({
|
||||||
providers: [
|
template: '',
|
||||||
{provide: 'dep', useValue: 'depValue'},
|
providers: [
|
||||||
{provide: 'a', useValue: 'aValue'},
|
{provide: 'dep', useValue: 'depValue'},
|
||||||
]
|
{provide: 'a', useValue: 'aValue'},
|
||||||
})
|
]
|
||||||
class MyComp {
|
})
|
||||||
}
|
class MyComp {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
'a',
|
||||||
const ctx =
|
{useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new Optional(), 'dep']]});
|
||||||
TestBed.configureTestingModule({declarations: [MyComp]}).createComponent(MyComp);
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp]})
|
||||||
|
.createComponent(MyComp);
|
||||||
|
|
||||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
expect(ctx.debugElement.injector.get('a')).toBe('mockA: depValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support SkipSelf', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Directive({
|
it('should support SkipSelf', () => {
|
||||||
selector: '[myDir]',
|
@Directive({
|
||||||
providers: [
|
selector: '[myDir]',
|
||||||
{provide: 'a', useValue: 'aValue'},
|
providers: [
|
||||||
{provide: 'dep', useValue: 'depValue'},
|
{provide: 'a', useValue: 'aValue'},
|
||||||
]
|
{provide: 'dep', useValue: 'depValue'},
|
||||||
})
|
]
|
||||||
class MyDir {
|
})
|
||||||
}
|
class MyDir {
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<div myDir></div>',
|
template: '<div myDir></div>',
|
||||||
providers: [
|
providers: [
|
||||||
{provide: 'dep', useValue: 'parentDepValue'},
|
{provide: 'dep', useValue: 'parentDepValue'},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class MyComp {
|
class MyComp {
|
||||||
}
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'a', {useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
'a',
|
||||||
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir]})
|
{useFactory: (dep: any) => `mockA: ${dep}`, deps: [[new SkipSelf(), 'dep']]});
|
||||||
.createComponent(MyComp);
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir]})
|
||||||
expect(ctx.debugElement.children[0].injector.get('a')).toBe('mockA: parentDepValue');
|
.createComponent(MyComp);
|
||||||
});
|
expect(ctx.debugElement.children[0].injector.get('a'))
|
||||||
|
.toBe('mockA: parentDepValue');
|
||||||
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should support multiple providers in a template', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Directive({
|
it('should support multiple providers in a template', () => {
|
||||||
selector: '[myDir1]',
|
@Directive({
|
||||||
providers: [
|
selector: '[myDir1]',
|
||||||
{provide: 'a', useValue: 'aValue1'},
|
providers: [
|
||||||
]
|
{provide: 'a', useValue: 'aValue1'},
|
||||||
})
|
]
|
||||||
class MyDir1 {
|
})
|
||||||
}
|
class MyDir1 {
|
||||||
|
}
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[myDir2]',
|
selector: '[myDir2]',
|
||||||
providers: [
|
providers: [
|
||||||
{provide: 'a', useValue: 'aValue2'},
|
{provide: 'a', useValue: 'aValue2'},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
class MyDir2 {
|
class MyDir2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<div myDir1></div><div myDir2></div>',
|
template: '<div myDir1></div><div myDir2></div>',
|
||||||
})
|
})
|
||||||
class MyComp {
|
class MyComp {
|
||||||
}
|
}
|
||||||
|
|
||||||
TestBed.overrideProvider('a', {useValue: 'mockA'});
|
TestBed.overrideProvider('a', {useValue: 'mockA'});
|
||||||
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir1, MyDir2]})
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp, MyDir1, MyDir2]})
|
||||||
.createComponent(MyComp);
|
.createComponent(MyComp);
|
||||||
expect(ctx.debugElement.children[0].injector.get('a')).toBe('mockA');
|
expect(ctx.debugElement.children[0].injector.get('a')).toBe('mockA');
|
||||||
expect(ctx.debugElement.children[1].injector.get('a')).toBe('mockA');
|
expect(ctx.debugElement.children[1].injector.get('a')).toBe('mockA');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('injecting eager providers into an eager overwritten provider', () => {
|
describe('injecting eager providers into an eager overwritten provider', () => {
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -692,7 +708,8 @@ class CompWithUrlTemplate {
|
||||||
constructor(@Inject('a') a: any, @Inject('b') b: any) {}
|
constructor(@Inject('a') a: any, @Inject('b') b: any) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy(
|
||||||
|
'FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
it('should inject providers that were declared before it', () => {
|
it('should inject providers that were declared before it', () => {
|
||||||
TestBed.overrideProvider(
|
TestBed.overrideProvider(
|
||||||
'b', {useFactory: (a: string) => `mockB: ${a}`, deps: ['a']});
|
'b', {useFactory: (a: string) => `mockB: ${a}`, deps: ['a']});
|
||||||
|
@ -702,16 +719,17 @@ class CompWithUrlTemplate {
|
||||||
expect(ctx.debugElement.injector.get('b')).toBe('mockB: aValue');
|
expect(ctx.debugElement.injector.get('b')).toBe('mockB: aValue');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy(
|
||||||
it('should inject providers that were declared after it', () => {
|
'FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
TestBed.overrideProvider(
|
it('should inject providers that were declared after it', () => {
|
||||||
'a', {useFactory: (b: string) => `mockA: ${b}`, deps: ['b']});
|
TestBed.overrideProvider(
|
||||||
const ctx = TestBed.configureTestingModule({declarations: [MyComp]})
|
'a', {useFactory: (b: string) => `mockA: ${b}`, deps: ['b']});
|
||||||
.createComponent(MyComp);
|
const ctx = TestBed.configureTestingModule({declarations: [MyComp]})
|
||||||
|
.createComponent(MyComp);
|
||||||
|
|
||||||
expect(ctx.debugElement.injector.get('a')).toBe('mockA: bValue');
|
expect(ctx.debugElement.injector.get('a')).toBe('mockA: bValue');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reset overrides when the testing modules is resetted', () => {
|
it('should reset overrides when the testing modules is resetted', () => {
|
||||||
|
@ -723,7 +741,7 @@ class CompWithUrlTemplate {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('overrideTemplateUsingTestingModule', () => {
|
describe('overrideTemplateUsingTestingModule', () => {
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
it('should compile the template in the context of the testing module', () => {
|
it('should compile the template in the context of the testing module', () => {
|
||||||
@Component({selector: 'comp', template: 'a'})
|
@Component({selector: 'comp', template: 'a'})
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
|
@ -752,19 +770,20 @@ class CompWithUrlTemplate {
|
||||||
expect(testDir !.test).toBe('some prop');
|
expect(testDir !.test).toBe('some prop');
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should throw if the TestBed is already created', () => {
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
@Component({selector: 'comp', template: 'a'})
|
it('should throw if the TestBed is already created', () => {
|
||||||
class MyComponent {
|
@Component({selector: 'comp', template: 'a'})
|
||||||
}
|
class MyComponent {
|
||||||
|
}
|
||||||
|
|
||||||
TestBed.get(Injector);
|
TestBed.get(Injector);
|
||||||
|
|
||||||
expect(() => TestBed.overrideTemplateUsingTestingModule(MyComponent, 'b'))
|
expect(() => TestBed.overrideTemplateUsingTestingModule(MyComponent, 'b'))
|
||||||
.toThrowError(
|
.toThrowError(
|
||||||
/Cannot override template when the test module has already been instantiated/);
|
/Cannot override template when the test module has already been instantiated/);
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-788: Support metadata override in TestBed (for AOT-compiled components)') &&
|
||||||
it('should reset overrides when the testing module is resetted', () => {
|
it('should reset overrides when the testing module is resetted', () => {
|
||||||
@Component({selector: 'comp', template: 'a'})
|
@Component({selector: 'comp', template: 'a'})
|
||||||
class MyComponent {
|
class MyComponent {
|
||||||
|
@ -790,28 +809,30 @@ class CompWithUrlTemplate {
|
||||||
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
|
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') && it('should use set up providers', fakeAsync(() => {
|
fixmeIvy('FW-553: TestBed is unaware of async compilation') &&
|
||||||
TestBed.compileComponents();
|
it('should use set up providers', fakeAsync(() => {
|
||||||
tick();
|
TestBed.compileComponents();
|
||||||
const compFixture =
|
tick();
|
||||||
TestBed.createComponent(CompWithUrlTemplate);
|
const compFixture = TestBed.createComponent(CompWithUrlTemplate);
|
||||||
expect(compFixture.nativeElement).toHaveText('Hello world!');
|
expect(compFixture.nativeElement).toHaveText('Hello world!');
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('useJit true', () => {
|
describe('useJit true', () => {
|
||||||
beforeEach(() => TestBed.configureCompiler({useJit: true}));
|
beforeEach(() => TestBed.configureCompiler({useJit: true}));
|
||||||
fixmeIvy('unknown') && it('should set the value into CompilerConfig',
|
obsoleteInIvy('the Render3 compiler JiT mode is not configurable') &&
|
||||||
inject([CompilerConfig], (config: CompilerConfig) => {
|
it('should set the value into CompilerConfig',
|
||||||
expect(config.useJit).toBe(true);
|
inject([CompilerConfig], (config: CompilerConfig) => {
|
||||||
}));
|
expect(config.useJit).toBe(true);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
describe('useJit false', () => {
|
describe('useJit false', () => {
|
||||||
beforeEach(() => TestBed.configureCompiler({useJit: false}));
|
beforeEach(() => TestBed.configureCompiler({useJit: false}));
|
||||||
fixmeIvy('unknown') && it('should set the value into CompilerConfig',
|
obsoleteInIvy('the Render3 compiler JiT mode is not configurable') &&
|
||||||
inject([CompilerConfig], (config: CompilerConfig) => {
|
it('should set the value into CompilerConfig',
|
||||||
expect(config.useJit).toBe(false);
|
inject([CompilerConfig], (config: CompilerConfig) => {
|
||||||
}));
|
expect(config.useJit).toBe(false);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -900,7 +921,7 @@ class CompWithUrlTemplate {
|
||||||
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
|
{providers: [{provide: ResourceLoader, useValue: {get: resourceLoaderGet}}]});
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
fixmeIvy('FW-553: TestBed is unaware of async compilation') &&
|
||||||
it('should report an error for declared components with templateUrl which never call TestBed.compileComponents',
|
it('should report an error for declared components with templateUrl which never call TestBed.compileComponents',
|
||||||
() => {
|
() => {
|
||||||
const itPromise = patchJasmineIt();
|
const itPromise = patchJasmineIt();
|
||||||
|
@ -919,7 +940,8 @@ class CompWithUrlTemplate {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fixmeIvy('unknown') &&
|
|
||||||
|
fixmeIvy(`FW-721: Bindings to unknown properties are not reported as errors`) &&
|
||||||
it('should error on unknown bound properties on custom elements by default', () => {
|
it('should error on unknown bound properties on custom elements by default', () => {
|
||||||
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
|
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
|
||||||
class ComponentUsingInvalidProperty {
|
class ComponentUsingInvalidProperty {
|
||||||
|
|
Loading…
Reference in New Issue