test(core): add JIRA references for root-casuse ivy TestBed failures (#27196)
PR Close #27196
This commit is contained in:
parent
a72250bace
commit
d666370e16
@ -15,10 +15,10 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,11 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(childComp.cfr.resolveComponentFactory(ChildComp) !.componentType).toBe(ChildComp);
|
||||
});
|
||||
|
||||
it('should not be able to get components from a parent component (content hierarchy)', () => {
|
||||
TestBed.overrideComponent(MainComp, {set: {template: '<child><nested></nested></child>'}});
|
||||
fixmeIvy('unknown') &&
|
||||
it('should not be able to get components from a parent component (content hierarchy)',
|
||||
() => {
|
||||
TestBed.overrideComponent(
|
||||
MainComp, {set: {template: '<child><nested></nested></child>'}});
|
||||
TestBed.overrideComponent(ChildComp, {set: {template: '<ng-content></ng-content>'}});
|
||||
|
||||
const compFixture = TestBed.createComponent(MainComp);
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {CompilerConfig} from '@angular/compiler';
|
||||
import {Compiler, ComponentFactory, ComponentRef, ErrorHandler, EventEmitter, Host, Inject, Injectable, InjectionToken, Injector, NO_ERRORS_SCHEMA, NgModule, NgModuleRef, OnDestroy, SkipSelf, ViewRef, ɵivyEnabled as ivyEnabled} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, ChangeDetectorRef, PipeTransform} from '@angular/core/src/change_detection/change_detection';
|
||||
import {getDebugContext} from '@angular/core/src/errors';
|
||||
@ -31,10 +30,10 @@ const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +212,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toEqual('Some other <div>HTML</div>');
|
||||
});
|
||||
|
||||
it('should consume binding to className using class alias', () => {
|
||||
fixmeIvy('unknown') && it('should consume binding to className using class alias', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp]});
|
||||
const template = '<div class="initial" [class]="ctxProp"></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -228,6 +227,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(nativeEl).not.toHaveCssClass('initial');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-587: Inputs with aliases in component decorators don\'t work') &&
|
||||
it('should consume binding to htmlFor using for alias', () => {
|
||||
const template = '<label [for]="ctxProp"></label>';
|
||||
const fixture = TestBed.configureTestingModule({declarations: [MyComp]})
|
||||
@ -241,7 +241,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(getDOM().getProperty(nativeEl, 'htmlFor')).toBe('foo');
|
||||
});
|
||||
|
||||
it('should consume directive watch expression change.', () => {
|
||||
fixmeIvy('unknown') && it('should consume directive watch expression change.', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
|
||||
const template = '<span>' +
|
||||
'<div my-dir [elprop]="ctxProp"></div>' +
|
||||
@ -265,7 +265,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('pipes', () => {
|
||||
it('should support pipes in bindings', () => {
|
||||
fixmeIvy('unknown') && it('should support pipes in bindings', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir, DoublePipe]});
|
||||
const template = '<div my-dir #dir="mydir" [elprop]="ctxProp | double"></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -291,7 +291,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
// GH issue 328 - https://github.com/angular/angular/issues/328
|
||||
it('should support different directive types on a single node', () => {
|
||||
fixmeIvy('unknown') && it('should support different directive types on a single node', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, ChildComp, MyDir]});
|
||||
const template = '<child-cmp my-dir [elprop]="ctxProp"></child-cmp>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -350,6 +350,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(tc.injector.get(EventDir)).not.toBeNull();
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should display correct error message for uninitialized @Output', () => {
|
||||
@Component({selector: 'my-uninitialized-output', template: '<p>It works!</p>'})
|
||||
class UninitializedOutputComp {
|
||||
@ -362,7 +363,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyComp, UninitializedOutputComp]});
|
||||
expect(() => TestBed.createComponent(MyComp))
|
||||
.toThrowError('@Output customEvent not initialized in \'UninitializedOutputComp\'.');
|
||||
.toThrowError(
|
||||
'@Output customEvent not initialized in \'UninitializedOutputComp\'.');
|
||||
});
|
||||
|
||||
it('should read directives metadata from their binding token', () => {
|
||||
@ -372,6 +374,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should support template directives via `<ng-template>` elements.', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]});
|
||||
const template =
|
||||
@ -399,6 +402,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(fixture.nativeElement).toHaveText('baz');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should not detach views in ViewContainers when the parent view is destroyed.', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, SomeViewport]});
|
||||
const template =
|
||||
@ -473,6 +477,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBeAnInstanceOf(ExportDir);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should assign a directive to a ref when it has multiple exportAs names', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, DirectiveWithMultipleExportAsNames]});
|
||||
@ -537,6 +542,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(value.tagName.toLowerCase()).toEqual('div');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should assign the TemplateRef to a user-defined variable', () => {
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]})
|
||||
@ -560,7 +566,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('variables', () => {
|
||||
it('should allow to use variables in a for loop', () => {
|
||||
fixmeIvy('unknown') && it('should allow to use variables in a for loop', () => {
|
||||
const template =
|
||||
'<ng-template ngFor [ngForOf]="[1]" let-i><child-cmp-no-template #cmp></child-cmp-no-template>{{i}}-{{cmp.ctxProp}}</ng-template>';
|
||||
|
||||
@ -577,6 +583,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('OnPush components', () => {
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should use ChangeDetectorRef to manually request a check', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, [[PushCmpWithRef]]]});
|
||||
const template = '<push-cmp-with-ref #cmp></push-cmp-with-ref>';
|
||||
@ -597,7 +604,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(cmp.numberOfChecks).toEqual(2);
|
||||
});
|
||||
|
||||
it('should be checked when its bindings got updated', () => {
|
||||
fixmeIvy('unknown') && it('should be checked when its bindings got updated', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]});
|
||||
const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>';
|
||||
@ -616,9 +623,11 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should allow to destroy a component from within a host event handler',
|
||||
fakeAsync(() => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, [[PushCmpWithHostEvent]]]});
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, [[PushCmpWithHostEvent]]]});
|
||||
const template = '<push-cmp-with-host-event></push-cmp-with-host-event>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
@ -634,7 +643,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}));
|
||||
}
|
||||
|
||||
it('should be checked when an event is fired', () => {
|
||||
fixmeIvy('unknown') && it('should be checked when an event is fired', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, PushCmp, EventCmp], imports: [CommonModule]});
|
||||
const template = '<push-cmp [prop]="ctxProp" #cmp></push-cmp>';
|
||||
@ -758,6 +767,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(childComponent.myHost).toBeAnInstanceOf(SomeDirective);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should support events via EventEmitter on regular elements', async(() => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, DirectiveEmittingEvent, DirectiveListeningEvent]});
|
||||
@ -788,11 +798,14 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
emitter.fireEvent('fired !');
|
||||
}));
|
||||
|
||||
fixmeIvy(
|
||||
'FW-665: Discovery util fails with Unable to find the given context data for the given target') &&
|
||||
it('should support events via EventEmitter on template elements', async(() => {
|
||||
const fixture =
|
||||
TestBed
|
||||
.configureTestingModule(
|
||||
{declarations: [MyComp, DirectiveEmittingEvent, DirectiveListeningEvent]})
|
||||
.configureTestingModule({
|
||||
declarations: [MyComp, DirectiveEmittingEvent, DirectiveListeningEvent]
|
||||
})
|
||||
.overrideComponent(MyComp, {
|
||||
set: {
|
||||
template:
|
||||
@ -839,7 +852,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
dir.triggerChange('two');
|
||||
}));
|
||||
|
||||
it('should support render events', () => {
|
||||
fixmeIvy('unknown') && it('should support render events', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveListeningDomEvent]});
|
||||
const template = '<div listener></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -860,7 +873,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(listener.eventTypes).toEqual([]);
|
||||
});
|
||||
|
||||
it('should support render global events', () => {
|
||||
fixmeIvy('unknown') && it('should support render global events', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveListeningDomEvent]});
|
||||
const template = '<div listener></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -907,7 +920,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toEqual('button');
|
||||
});
|
||||
|
||||
it('should support updating host element via hostProperties', () => {
|
||||
fixmeIvy('unknown') && it('should support updating host element via hostProperties', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveUpdatingHostProperties]});
|
||||
const template = '<div update-host-properties></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -942,7 +955,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(tc.properties['title']).toBe(undefined);
|
||||
});
|
||||
|
||||
it('should not allow pipes in hostProperties', () => {
|
||||
fixmeIvy('unknown') && it('should not allow pipes in hostProperties', () => {
|
||||
@Directive({selector: '[host-properties]', host: {'[id]': 'id | uppercase'}})
|
||||
class DirectiveWithHostProps {
|
||||
}
|
||||
@ -977,7 +990,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(dir.receivedArgs).toEqual(['one', undefined]);
|
||||
});
|
||||
|
||||
it('should not allow pipes in hostListeners', () => {
|
||||
fixmeIvy('unknown') && it('should not allow pipes in hostListeners', () => {
|
||||
@Directive({selector: '[host-listener]', host: {'(click)': 'doIt() | somePipe'}})
|
||||
class DirectiveWithHostListener {
|
||||
}
|
||||
@ -1013,9 +1026,11 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
}
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should support render global events from multiple directives', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, DirectiveListeningDomEvent, DirectiveListeningDomEventOther]});
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MyComp, DirectiveListeningDomEvent, DirectiveListeningDomEventOther]
|
||||
});
|
||||
const template = '<div *ngIf="ctxBoolProp" listener listenerother></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
@ -1092,6 +1107,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toHaveText('dynamic greet');
|
||||
}));
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create a component that has been freshly compiled', () => {
|
||||
@Component({template: ''})
|
||||
class RootComp {
|
||||
@ -1117,8 +1133,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
class MyModule {
|
||||
}
|
||||
|
||||
const compFixture =
|
||||
TestBed.configureTestingModule({imports: [RootModule]}).createComponent(RootComp);
|
||||
const compFixture = TestBed.configureTestingModule({imports: [RootModule]})
|
||||
.createComponent(RootComp);
|
||||
const compiler = <Compiler>TestBed.get(Compiler);
|
||||
const myCompFactory =
|
||||
<ComponentFactory<MyComp>>compiler.compileModuleAndAllComponentsSync(MyModule)
|
||||
@ -1131,6 +1147,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(compRef.instance.someToken).toBe('someRootValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create a component with the passed NgModuleRef', () => {
|
||||
@Component({template: ''})
|
||||
class RootComp {
|
||||
@ -1154,11 +1171,13 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
class MyModule {
|
||||
}
|
||||
|
||||
const compFixture =
|
||||
TestBed.configureTestingModule({imports: [RootModule]}).createComponent(RootComp);
|
||||
const compFixture = TestBed.configureTestingModule({imports: [RootModule]})
|
||||
.createComponent(RootComp);
|
||||
const compiler = <Compiler>TestBed.get(Compiler);
|
||||
const myModule = compiler.compileModuleSync(MyModule).create(TestBed.get(NgModuleRef));
|
||||
const myCompFactory = (<ComponentFactoryResolver>TestBed.get(ComponentFactoryResolver))
|
||||
const myModule =
|
||||
compiler.compileModuleSync(MyModule).create(TestBed.get(NgModuleRef));
|
||||
const myCompFactory =
|
||||
(<ComponentFactoryResolver>TestBed.get(ComponentFactoryResolver))
|
||||
.resolveComponentFactory(MyComp);
|
||||
|
||||
// Note: MyComp was declared as entryComponent in the RootModule,
|
||||
@ -1169,6 +1188,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(compRef.instance.someToken).toBe('someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create a component with the NgModuleRef of the ComponentFactoryResolver',
|
||||
() => {
|
||||
@Component({template: ''})
|
||||
@ -1213,6 +1233,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('.insert', () => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should throw with destroyed views', async(() => {
|
||||
const fixture = TestBed.configureTestingModule({schemas: [NO_ERRORS_SCHEMA]})
|
||||
.createComponent(MyComp);
|
||||
@ -1229,6 +1250,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('.move', () => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should throw with destroyed views', async(() => {
|
||||
const fixture = TestBed.configureTestingModule({schemas: [NO_ERRORS_SCHEMA]})
|
||||
.createComponent(MyComp);
|
||||
@ -1246,7 +1268,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
});
|
||||
|
||||
it('should support static attributes', () => {
|
||||
fixmeIvy('unknown') && it('should support static attributes', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, NeedsAttribute]});
|
||||
const template = '<input static type="text" title>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -1259,7 +1281,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(needsAttribute.fooAttribute).toBeNull();
|
||||
});
|
||||
|
||||
it('should support custom interpolation', () => {
|
||||
fixmeIvy('unknown') && it('should support custom interpolation', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
MyComp, ComponentWithCustomInterpolationA, ComponentWithCustomInterpolationB,
|
||||
@ -1300,7 +1322,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(comp.injectable).toBeAnInstanceOf(InjectableService);
|
||||
});
|
||||
|
||||
it('should support viewProviders', () => {
|
||||
fixmeIvy('unknown') && it('should support viewProviders', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MyComp, DirectiveProvidingInjectableInView, DirectiveConsumingInjectable],
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
@ -1412,6 +1434,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(getDOM().querySelectorAll(fixture.nativeElement, 'script').length).toEqual(0);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-662: Components without selector are not supported') &&
|
||||
it('should throw when using directives without selector', () => {
|
||||
@Directive({})
|
||||
class SomeDirective {
|
||||
@ -1423,9 +1446,11 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyComp, SomeDirective, SomeComponent]});
|
||||
expect(() => TestBed.createComponent(MyComp))
|
||||
.toThrowError(`Directive ${stringify(SomeDirective)} has no selector, please add it!`);
|
||||
.toThrowError(
|
||||
`Directive ${stringify(SomeDirective)} has no selector, please add it!`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-662: Components without selector are not supported') &&
|
||||
it('should use a default element name for components without selectors', () => {
|
||||
let noSelectorComponentFactory: ComponentFactory<SomeComponent> = undefined !;
|
||||
|
||||
@ -1433,7 +1458,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
class NoSelectorComponent {
|
||||
}
|
||||
|
||||
@Component({selector: 'some-comp', template: '', entryComponents: [NoSelectorComponent]})
|
||||
@Component(
|
||||
{selector: 'some-comp', template: '', entryComponents: [NoSelectorComponent]})
|
||||
class SomeComponent {
|
||||
constructor(componentFactoryResolver: ComponentFactoryResolver) {
|
||||
// grab its own component factory
|
||||
@ -1449,23 +1475,26 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
expect(noSelectorComponentFactory.selector).toBe('ng-component');
|
||||
|
||||
expect(
|
||||
getDOM()
|
||||
.nodeName(noSelectorComponentFactory.create(Injector.NULL).location.nativeElement)
|
||||
expect(getDOM()
|
||||
.nodeName(
|
||||
noSelectorComponentFactory.create(Injector.NULL).location.nativeElement)
|
||||
.toLowerCase())
|
||||
.toEqual('ng-component');
|
||||
});
|
||||
});
|
||||
|
||||
describe('error handling', () => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should report a meaningful error when a directive is missing annotation', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, SomeDirectiveMissingAnnotation]});
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, SomeDirectiveMissingAnnotation]});
|
||||
|
||||
expect(() => TestBed.createComponent(MyComp))
|
||||
.toThrowError(
|
||||
`Unexpected value '${stringify(SomeDirectiveMissingAnnotation)}' declared by the module 'DynamicTestModule'. Please add a @Pipe/@Directive/@Component annotation.`);
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should report a meaningful error when a component is missing view annotation', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, ComponentWithoutView]});
|
||||
try {
|
||||
@ -1477,6 +1506,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should provide an error context when an error happens in DI', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MyComp, DirectiveThrowingAnError],
|
||||
@ -1495,6 +1525,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should provide an error context when an error happens in change detection', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveThrowingAnError]});
|
||||
const template = `<input [value]="one.two.three" #local>`;
|
||||
@ -1513,6 +1544,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should provide an error context when an error happens in change detection (text node)',
|
||||
() => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp]});
|
||||
@ -1591,7 +1623,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('Property bindings', () => {
|
||||
it('should throw on bindings to unknown properties', () => {
|
||||
fixmeIvy('unknown') && it('should throw on bindings to unknown properties', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp]});
|
||||
const template = '<div unknown="{{ctxProp}}"></div>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -1625,8 +1657,10 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(el.title).toBeFalsy();
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should work when a directive uses hostProperty to update the DOM element', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveWithTitleAndHostProperty]});
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MyComp, DirectiveWithTitleAndHostProperty]});
|
||||
const template = '<span [title]="ctxProp"></span>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
@ -1640,6 +1674,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('logging property updates', () => {
|
||||
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
|
||||
it('should reflect property values as attributes', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
|
||||
const template = '<div>' +
|
||||
@ -1655,19 +1690,23 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toContain('ng-reflect-dir-prop="hello"');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
|
||||
it(`should work with prop names containing '$'`, () => {
|
||||
TestBed.configureTestingModule({declarations: [ParentCmp, SomeCmpWithInput]});
|
||||
const fixture = TestBed.createComponent(ParentCmp);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(getDOM().getInnerHTML(fixture.nativeElement)).toContain('ng-reflect-test_="hello"');
|
||||
expect(getDOM().getInnerHTML(fixture.nativeElement))
|
||||
.toContain('ng-reflect-test_="hello"');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
|
||||
it('should reflect property values on template comments', () => {
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp]})
|
||||
.overrideComponent(
|
||||
MyComp, {set: {template: '<ng-template [ngIf]="ctxBoolProp"></ng-template>'}})
|
||||
MyComp,
|
||||
{set: {template: '<ng-template [ngIf]="ctxBoolProp"></ng-template>'}})
|
||||
.createComponent(MyComp);
|
||||
|
||||
fixture.componentInstance.ctxBoolProp = true;
|
||||
@ -1677,6 +1716,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toContain('"ng\-reflect\-ng\-if"\: "true"');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-664: ng-reflect-* is not supported') &&
|
||||
it('should indicate when toString() throws', () => {
|
||||
TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
|
||||
const template = '<div my-dir [elprop]="toStringThrow"></div>';
|
||||
|
@ -15,7 +15,8 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
fixmeIvy('unknown') && describe('Jit Summaries', () => {
|
||||
// ivy fix in https://github.com/angular/angular/pull/26871
|
||||
fixmeIvy('FW-514: ngSummary shims not generated by ngtsc') && describe('Jit Summaries', () => {
|
||||
let instances: Map<any, Base>;
|
||||
let summaries: () => any[];
|
||||
|
||||
|
@ -15,10 +15,10 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
});
|
||||
|
||||
fixmeIvy('FW-663: ReferenceError: goog is not defined') &&
|
||||
it('should support the "i18n" attribute', () => {
|
||||
const template = '<ng-container i18n>foo</ng-container>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -49,6 +50,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(el).toHaveText('foo');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-678: ivy generates different DOM structure for <ng-container>') &&
|
||||
it('should be rendered as comment with children as siblings', () => {
|
||||
const template = '<ng-container><p></p></ng-container>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -63,6 +65,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(getDOM().tagName(children[1]).toUpperCase()).toEqual('P');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-678: ivy generates different DOM structure for <ng-container>') &&
|
||||
it('should support nesting', () => {
|
||||
const template =
|
||||
'<ng-container>1</ng-container><ng-container><ng-container>2</ng-container></ng-container>';
|
||||
@ -81,6 +84,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(children[4]).toHaveText('2');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-678: ivy generates different DOM structure for <ng-container>') &&
|
||||
it('should group inner nodes', () => {
|
||||
const template = '<ng-container *ngIf="ctxBoolProp"><p></p><b></b></ng-container>';
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
@ -130,6 +134,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(dir.text).toEqual('container');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should contain all direct child directives in a <ng-container> (content dom)', () => {
|
||||
const template =
|
||||
'<needs-content-children #q><ng-container><div text="foo"></div></ng-container></needs-content-children>';
|
||||
|
@ -100,11 +100,10 @@ class DummyConsole implements Console {
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +143,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
|
||||
describe('errors', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error when exporting a directive that was neither declared nor imported', () => {
|
||||
@NgModule({exports: [SomeDirective]})
|
||||
class SomeModule {
|
||||
@ -154,6 +154,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`Can't export directive ${stringify(SomeDirective)} from ${stringify(SomeModule)} as it was neither declared nor imported!`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error when exporting a pipe that was neither declared nor imported', () => {
|
||||
@NgModule({exports: [SomePipe]})
|
||||
class SomeModule {
|
||||
@ -164,6 +165,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`Can't export pipe ${stringify(SomePipe)} from ${stringify(SomeModule)} as it was neither declared nor imported!`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error if a directive is declared in more than 1 module', () => {
|
||||
@NgModule({declarations: [SomeDirective]})
|
||||
class Module1 {
|
||||
@ -182,6 +184,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomeDirective)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error if a directive is declared in more than 1 module also if the module declaring it is imported',
|
||||
() => {
|
||||
@NgModule({declarations: [SomeDirective], exports: [SomeDirective]})
|
||||
@ -199,6 +202,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomeDirective)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error if a pipe is declared in more than 1 module', () => {
|
||||
@NgModule({declarations: [SomePipe]})
|
||||
class Module1 {
|
||||
@ -217,6 +221,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
`You can also create a new NgModule that exports and includes ${stringify(SomePipe)} then import that NgModule in ${stringify(Module1)} and ${stringify(Module2)}.`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error if a pipe is declared in more than 1 module also if the module declaring it is imported',
|
||||
() => {
|
||||
@NgModule({declarations: [SomePipe], exports: [SomePipe]})
|
||||
@ -237,6 +242,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('schemas', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should error on unknown bound properties on custom elements by default', () => {
|
||||
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
|
||||
class ComponentUsingInvalidProperty {
|
||||
@ -249,14 +255,17 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(() => createModule(SomeModule)).toThrowError(/Can't bind to 'someUnknownProp'/);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not error on unknown bound properties on custom elements when using the CUSTOM_ELEMENTS_SCHEMA',
|
||||
() => {
|
||||
@Component({template: '<some-element [someUnknownProp]="true"></some-element>'})
|
||||
class ComponentUsingInvalidProperty {
|
||||
}
|
||||
|
||||
@NgModule(
|
||||
{schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [ComponentUsingInvalidProperty]})
|
||||
@NgModule({
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [ComponentUsingInvalidProperty]
|
||||
})
|
||||
class SomeModule {
|
||||
}
|
||||
|
||||
@ -275,6 +284,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
afterEach(() => clearModulesForTest());
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should register loaded modules', () => {
|
||||
createModule(SomeModule);
|
||||
const factory = getModuleFactory(token);
|
||||
@ -282,6 +292,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(factory.moduleType).toBe(SomeModule);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when registering a duplicate module', () => {
|
||||
createModule(SomeModule);
|
||||
expect(() => createModule(SomeOtherModule)).toThrowError(/Duplicate module registered/);
|
||||
@ -289,13 +300,15 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('entryComponents', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create ComponentFactories in root modules', () => {
|
||||
@NgModule({declarations: [SomeComp], entryComponents: [SomeComp]})
|
||||
class SomeModule {
|
||||
}
|
||||
|
||||
const ngModule = createModule(SomeModule);
|
||||
expect(ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
expect(
|
||||
ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
.toBe(SomeComp);
|
||||
expect(ngModule.injector.get(ComponentFactoryResolver)
|
||||
.resolveComponentFactory(SomeComp)
|
||||
@ -303,7 +316,9 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe(SomeComp);
|
||||
});
|
||||
|
||||
it('should throw if we cannot find a module associated with a module-level entryComponent', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw if we cannot find a module associated with a module-level entryComponent',
|
||||
() => {
|
||||
@Component({template: ''})
|
||||
class SomeCompWithEntryComponents {
|
||||
}
|
||||
@ -317,6 +332,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
'Component SomeCompWithEntryComponents is not part of any NgModule or the module has not been imported into your module.');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw if we cannot find a module associated with a component-level entryComponent',
|
||||
() => {
|
||||
@Component({template: '', entryComponents: [SomeComp]})
|
||||
@ -332,6 +348,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
'Component SomeComp is not part of any NgModule or the module has not been imported into your module.');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create ComponentFactories via ANALYZE_FOR_ENTRY_COMPONENTS', () => {
|
||||
@NgModule({
|
||||
declarations: [SomeComp],
|
||||
@ -345,7 +362,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
|
||||
const ngModule = createModule(SomeModule);
|
||||
expect(ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
expect(
|
||||
ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
.toBe(SomeComp);
|
||||
expect(ngModule.injector.get(ComponentFactoryResolver)
|
||||
.resolveComponentFactory(SomeComp)
|
||||
@ -353,6 +371,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe(SomeComp);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create ComponentFactories in imported modules', () => {
|
||||
@NgModule({declarations: [SomeComp], entryComponents: [SomeComp]})
|
||||
class SomeImportedModule {
|
||||
@ -363,7 +382,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
|
||||
const ngModule = createModule(SomeModule);
|
||||
expect(ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
expect(
|
||||
ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
.toBe(SomeComp);
|
||||
expect(ngModule.injector.get(ComponentFactoryResolver)
|
||||
.resolveComponentFactory(SomeComp)
|
||||
@ -371,6 +391,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe(SomeComp);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create ComponentFactories if the component was imported', () => {
|
||||
@NgModule({declarations: [SomeComp], exports: [SomeComp]})
|
||||
class SomeImportedModule {
|
||||
@ -381,7 +402,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
}
|
||||
|
||||
const ngModule = createModule(SomeModule);
|
||||
expect(ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
expect(
|
||||
ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
.toBe(SomeComp);
|
||||
expect(ngModule.injector.get(ComponentFactoryResolver)
|
||||
.resolveComponentFactory(SomeComp)
|
||||
@ -392,16 +414,19 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('bootstrap components', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create ComponentFactories', () => {
|
||||
@NgModule({declarations: [SomeComp], bootstrap: [SomeComp]})
|
||||
class SomeModule {
|
||||
}
|
||||
|
||||
const ngModule = createModule(SomeModule);
|
||||
expect(ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
expect(
|
||||
ngModule.componentFactoryResolver.resolveComponentFactory(SomeComp) !.componentType)
|
||||
.toBe(SomeComp);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should store the ComponentFactories in the NgModuleInjector', () => {
|
||||
@NgModule({declarations: [SomeComp], bootstrap: [SomeComp]})
|
||||
class SomeModule {
|
||||
@ -416,6 +441,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('directives and pipes', () => {
|
||||
describe('declarations', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should be supported in root modules', () => {
|
||||
@NgModule({
|
||||
declarations: [CompUsingModuleDirectiveAndPipe, SomeDirective, SomePipe],
|
||||
@ -431,6 +457,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe('transformed someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should be supported in imported modules', () => {
|
||||
@NgModule({
|
||||
declarations: [CompUsingModuleDirectiveAndPipe, SomeDirective, SomePipe],
|
||||
@ -450,6 +477,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should be supported in nested components', () => {
|
||||
@Component({
|
||||
selector: 'parent',
|
||||
@ -460,8 +488,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ParentCompUsingModuleDirectiveAndPipe, CompUsingModuleDirectiveAndPipe, SomeDirective,
|
||||
SomePipe
|
||||
ParentCompUsingModuleDirectiveAndPipe, CompUsingModuleDirectiveAndPipe,
|
||||
SomeDirective, SomePipe
|
||||
],
|
||||
entryComponents: [ParentCompUsingModuleDirectiveAndPipe]
|
||||
})
|
||||
@ -477,8 +505,10 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('import/export', () => {
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support exported directives and pipes', () => {
|
||||
@NgModule({declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
@NgModule(
|
||||
{declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
class SomeImportedModule {
|
||||
}
|
||||
|
||||
@ -497,6 +527,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe('transformed someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support exported directives and pipes if the module is wrapped into an `ModuleWithProviders`',
|
||||
() => {
|
||||
@NgModule(
|
||||
@ -519,8 +550,10 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe('transformed someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support reexported modules', () => {
|
||||
@NgModule({declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
@NgModule(
|
||||
{declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
class SomeReexportedModule {
|
||||
}
|
||||
|
||||
@ -542,8 +575,10 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe('transformed someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support exporting individual directives of an imported module', () => {
|
||||
@NgModule({declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
@NgModule(
|
||||
{declarations: [SomeDirective, SomePipe], exports: [SomeDirective, SomePipe]})
|
||||
class SomeReexportedModule {
|
||||
}
|
||||
|
||||
@ -565,6 +600,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toBe('transformed someValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not use non exported pipes of an imported module', () => {
|
||||
@NgModule({
|
||||
declarations: [SomePipe],
|
||||
@ -584,6 +620,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
.toThrowError(/The pipe 'somePipe' could not be found/);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not use non exported directives of an imported module', () => {
|
||||
@NgModule({
|
||||
declarations: [SomeDirective],
|
||||
@ -599,7 +636,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
class SomeModule {
|
||||
}
|
||||
|
||||
expect(() => createComp(SomeComp, SomeModule)).toThrowError(/Can't bind to 'someDir'/);
|
||||
expect(() => createComp(SomeComp, SomeModule))
|
||||
.toThrowError(/Can't bind to 'someDir'/);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -619,9 +657,11 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
return createModule(SomeModule, parent).injector;
|
||||
}
|
||||
|
||||
it('should provide the module',
|
||||
() => { expect(createInjector([]).get(moduleType)).toBeAnInstanceOf(moduleType); });
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should provide the module', () => {
|
||||
expect(createInjector([]).get(moduleType)).toBeAnInstanceOf(moduleType);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should instantiate a class without dependencies', () => {
|
||||
const injector = createInjector([Engine]);
|
||||
const engine = injector.get(Engine);
|
||||
@ -629,6 +669,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(engine).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should resolve dependencies based on type information', () => {
|
||||
const injector = createInjector([Engine, Car]);
|
||||
const car = injector.get(Car);
|
||||
@ -637,6 +678,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(car.engine).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should resolve dependencies based on @Inject annotation', () => {
|
||||
const injector = createInjector([TurboEngine, Engine, CarWithInject]);
|
||||
const car = injector.get(CarWithInject);
|
||||
@ -645,17 +687,19 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(car.engine).toBeAnInstanceOf(TurboEngine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when no type and not @Inject (class case)', () => {
|
||||
expect(() => createInjector([NoAnnotations]))
|
||||
.toThrowError('Can\'t resolve all parameters for NoAnnotations: (?).');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when no type and not @Inject (factory case)', () => {
|
||||
expect(() => createInjector([{provide: 'someToken', useFactory: factoryFn}]))
|
||||
.toThrowError('Can\'t resolve all parameters for factoryFn: (?).');
|
||||
});
|
||||
|
||||
it('should cache instances', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should cache instances', () => {
|
||||
const injector = createInjector([Engine]);
|
||||
|
||||
const e1 = injector.get(Engine);
|
||||
@ -664,31 +708,33 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(e1).toBe(e2);
|
||||
});
|
||||
|
||||
it('should provide to a value', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should provide to a value', () => {
|
||||
const injector = createInjector([{provide: Engine, useValue: 'fake engine'}]);
|
||||
|
||||
const engine = injector.get(Engine);
|
||||
expect(engine).toEqual('fake engine');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should provide to a factory', () => {
|
||||
function sportsCarFactory(e: Engine) { return new SportsCar(e); }
|
||||
|
||||
const injector =
|
||||
createInjector([Engine, {provide: Car, useFactory: sportsCarFactory, deps: [Engine]}]);
|
||||
const injector = createInjector(
|
||||
[Engine, {provide: Car, useFactory: sportsCarFactory, deps: [Engine]}]);
|
||||
|
||||
const car = injector.get(Car);
|
||||
expect(car).toBeAnInstanceOf(SportsCar);
|
||||
expect(car.engine).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should supporting provider to null', () => {
|
||||
const injector = createInjector([{provide: Engine, useValue: null}]);
|
||||
const engine = injector.get(Engine);
|
||||
expect(engine).toBeNull();
|
||||
});
|
||||
|
||||
it('should provide to an alias', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should provide to an alias', () => {
|
||||
const injector = createInjector([
|
||||
Engine, {provide: SportsCar, useClass: SportsCar},
|
||||
{provide: Car, useExisting: SportsCar}
|
||||
@ -700,6 +746,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(car).toBe(sportsCar);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support multiProviders', () => {
|
||||
const injector = createInjector([
|
||||
Engine, {provide: CARS, useClass: SportsCar, multi: true},
|
||||
@ -712,6 +759,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(cars[1]).toBeAnInstanceOf(CarWithOptionalEngine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support multiProviders that are created using useExisting', () => {
|
||||
const injector = createInjector(
|
||||
[Engine, SportsCar, {provide: CARS, useExisting: SportsCar, multi: true}]);
|
||||
@ -721,12 +769,14 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(cars[0]).toBe(injector.get(SportsCar));
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when the aliased provider does not exist', () => {
|
||||
const injector = createInjector([{provide: 'car', useExisting: SportsCar}]);
|
||||
const e = `NullInjectorError: No provider for ${stringify(SportsCar)}!`;
|
||||
expect(() => injector.get('car')).toThrowError(e);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should handle forwardRef in useExisting', () => {
|
||||
const injector = createInjector([
|
||||
{provide: 'originalEngine', useClass: forwardRef(() => Engine)},
|
||||
@ -735,15 +785,18 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('aliasedEngine')).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support overriding factory dependencies', () => {
|
||||
const injector = createInjector(
|
||||
[Engine, {provide: Car, useFactory: (e: Engine) => new SportsCar(e), deps: [Engine]}]);
|
||||
const injector = createInjector([
|
||||
Engine, {provide: Car, useFactory: (e: Engine) => new SportsCar(e), deps: [Engine]}
|
||||
]);
|
||||
|
||||
const car = injector.get(Car);
|
||||
expect(car).toBeAnInstanceOf(SportsCar);
|
||||
expect(car.engine).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support optional dependencies', () => {
|
||||
const injector = createInjector([CarWithOptionalEngine]);
|
||||
|
||||
@ -751,6 +804,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(car.engine).toBeNull();
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should flatten passed-in providers', () => {
|
||||
const injector = createInjector([[[Engine, Car]]]);
|
||||
|
||||
@ -758,39 +812,43 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(car).toBeAnInstanceOf(Car);
|
||||
});
|
||||
|
||||
it('should use the last provider when there are multiple providers for same token', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should use the last provider when there are multiple providers for same token',
|
||||
() => {
|
||||
const injector = createInjector(
|
||||
[{provide: Engine, useClass: Engine}, {provide: Engine, useClass: TurboEngine}]);
|
||||
|
||||
expect(injector.get(Engine)).toBeAnInstanceOf(TurboEngine);
|
||||
});
|
||||
|
||||
it('should use non-type tokens', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should use non-type tokens', () => {
|
||||
const injector = createInjector([{provide: 'token', useValue: 'value'}]);
|
||||
|
||||
expect(injector.get('token')).toEqual('value');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when given invalid providers', () => {
|
||||
expect(() => createInjector(<any>['blah']))
|
||||
.toThrowError(
|
||||
`Invalid provider for the NgModule 'SomeModule' - only instances of Provider and Type are allowed, got: [?blah?]`);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when given blank providers', () => {
|
||||
expect(() => createInjector(<any>[null, {provide: 'token', useValue: 'value'}]))
|
||||
.toThrowError(
|
||||
`Invalid provider for the NgModule 'SomeModule' - only instances of Provider and Type are allowed, got: [?null?, ...]`);
|
||||
});
|
||||
|
||||
it('should provide itself', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should provide itself', () => {
|
||||
const parent = createInjector([]);
|
||||
const child = createInjector([], parent);
|
||||
|
||||
expect(child.get(Injector)).toBe(child);
|
||||
});
|
||||
|
||||
it('should provide undefined', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should provide undefined', () => {
|
||||
let factoryCounter = 0;
|
||||
|
||||
const injector = createInjector([{
|
||||
@ -808,6 +866,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('injecting lazy providers into an eager provider via Injector.get', () => {
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should inject providers that were declared before it', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
@ -827,6 +886,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(createModule(MyModule).injector.get('eager')).toBe('eagerValue: lazyValue');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should inject providers that were declared after it', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
@ -849,6 +909,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('injecting eager providers into an eager provider via Injector.get', () => {
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should inject providers that were declared before it', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
@ -868,6 +929,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(createModule(MyModule).injector.get('eager2')).toBe('v2: v1');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should inject providers that were declared after it', () => {
|
||||
@NgModule({
|
||||
providers: [
|
||||
@ -887,6 +949,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(createModule(MyModule).injector.get('eager1')).toBe('v1: v2');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('eager providers should get initialized only once', () => {
|
||||
@Injectable()
|
||||
class MyService1 {
|
||||
@ -917,24 +980,27 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when no provider defined', () => {
|
||||
const injector = createInjector([]);
|
||||
expect(() => injector.get('NonExisting'))
|
||||
.toThrowError('NullInjectorError: No provider for NonExisting!');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should throw when trying to instantiate a cyclic dependency', () => {
|
||||
expect(() => createInjector([Car, {provide: Engine, useClass: CyclicEngine}]))
|
||||
.toThrowError(/Cannot instantiate cyclic dependency! Car/g);
|
||||
});
|
||||
|
||||
it('should support null values', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should support null values', () => {
|
||||
const injector = createInjector([{provide: 'null', useValue: null}]);
|
||||
expect(injector.get('null')).toBe(null);
|
||||
});
|
||||
|
||||
|
||||
describe('child', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should load instances from parent injector', () => {
|
||||
const parent = createInjector([Engine]);
|
||||
const child = createInjector([], parent);
|
||||
@ -945,6 +1011,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(engineFromChild).toBe(engineFromParent);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not use the child providers when resolving the dependencies of a parent provider',
|
||||
() => {
|
||||
const parent = createInjector([Car, Engine]);
|
||||
@ -954,6 +1021,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(carFromChild.engine).toBeAnInstanceOf(Engine);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should create new instance in a child injector', () => {
|
||||
const parent = createInjector([Engine]);
|
||||
const child = createInjector([{provide: Engine, useClass: TurboEngine}], parent);
|
||||
@ -969,10 +1037,14 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
describe('depedency resolution', () => {
|
||||
describe('@Self()', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should return a dependency from self', () => {
|
||||
const inj = createInjector([
|
||||
Engine,
|
||||
{provide: Car, useFactory: (e: Engine) => new Car(e), deps: [[Engine, new Self()]]}
|
||||
Engine, {
|
||||
provide: Car,
|
||||
useFactory: (e: Engine) => new Car(e),
|
||||
deps: [[Engine, new Self()]]
|
||||
}
|
||||
]);
|
||||
|
||||
expect(inj.get(Car)).toBeAnInstanceOf(Car);
|
||||
@ -980,7 +1052,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('default', () => {
|
||||
it('should not skip self', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') && it('should not skip self', () => {
|
||||
const parent = createInjector([Engine]);
|
||||
const child = createInjector(
|
||||
[
|
||||
@ -995,7 +1067,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('lifecycle', () => {
|
||||
it('should instantiate modules eagerly', () => {
|
||||
fixmeIvy('unknown') && it('should instantiate modules eagerly', () => {
|
||||
let created = false;
|
||||
|
||||
@NgModule()
|
||||
@ -1012,6 +1084,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(created).toBe(true);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should instantiate providers that are not used by a module lazily', () => {
|
||||
let created = false;
|
||||
|
||||
@ -1026,6 +1099,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(created).toBe(false);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support ngOnDestroy on any provider', () => {
|
||||
let destroyed = false;
|
||||
|
||||
@ -1045,6 +1119,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(destroyed).toBe(true);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should support ngOnDestroy for lazy providers', () => {
|
||||
let created = false;
|
||||
let destroyed = false;
|
||||
@ -1076,6 +1151,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('imported and exported modules', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should add the providers of imported modules', () => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported'}]})
|
||||
class ImportedModule {
|
||||
@ -1092,15 +1168,17 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('imported');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should add the providers of imported ModuleWithProviders', () => {
|
||||
@NgModule()
|
||||
class ImportedModule {
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
{ngModule: ImportedModule, providers: [{provide: 'token1', useValue: 'imported'}]}
|
||||
]
|
||||
imports: [{
|
||||
ngModule: ImportedModule,
|
||||
providers: [{provide: 'token1', useValue: 'imported'}]
|
||||
}]
|
||||
})
|
||||
class SomeModule {
|
||||
}
|
||||
@ -1112,6 +1190,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('imported');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of imported modules', () => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported'}]})
|
||||
class ImportedModule {
|
||||
@ -1126,6 +1205,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('direct');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should overwrite the providers of imported ModuleWithProviders', () => {
|
||||
@NgModule()
|
||||
class ImportedModule {
|
||||
@ -1133,9 +1213,10 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
@NgModule({
|
||||
providers: [{provide: 'token1', useValue: 'direct'}],
|
||||
imports: [
|
||||
{ngModule: ImportedModule, providers: [{provide: 'token1', useValue: 'imported'}]}
|
||||
]
|
||||
imports: [{
|
||||
ngModule: ImportedModule,
|
||||
providers: [{provide: 'token1', useValue: 'imported'}]
|
||||
}]
|
||||
})
|
||||
class SomeModule {
|
||||
}
|
||||
@ -1144,7 +1225,9 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('direct');
|
||||
});
|
||||
|
||||
it('should overwrite the providers of imported modules on the second import level', () => {
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of imported modules on the second import level',
|
||||
() => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported'}]})
|
||||
class ImportedModuleLevel2 {
|
||||
}
|
||||
@ -1164,6 +1247,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('direct');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should add the providers of exported modules', () => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'exported'}]})
|
||||
class ExportedValue {
|
||||
@ -1180,6 +1264,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('exported');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of exported modules', () => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'exported'}]})
|
||||
class ExportedModule {
|
||||
@ -1194,6 +1279,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('direct');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of imported modules by following imported modules',
|
||||
() => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported1'}]})
|
||||
@ -1212,6 +1298,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('imported2');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of exported modules by following exported modules',
|
||||
() => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'exported1'}]})
|
||||
@ -1230,6 +1317,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('exported2');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should overwrite the providers of imported modules by exported modules', () => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported'}]})
|
||||
class ImportedModule {
|
||||
@ -1247,6 +1335,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('exported');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not overwrite the providers if a module was already used on the same level',
|
||||
() => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported1'}]})
|
||||
@ -1265,6 +1354,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('imported2');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
|
||||
it('should not overwrite the providers if a module was already used on a child level',
|
||||
() => {
|
||||
@NgModule({providers: [{provide: 'token1', useValue: 'imported1'}]})
|
||||
@ -1287,6 +1377,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get('token1')).toBe('imported2');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should throw when given invalid providers in an imported ModuleWithProviders', () => {
|
||||
@NgModule()
|
||||
class ImportedModule1 {
|
||||
@ -1303,6 +1394,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
|
||||
describe('tree shakable providers', () => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('definition should not persist across NgModuleRef instances', () => {
|
||||
@NgModule()
|
||||
class SomeModule {
|
||||
@ -1322,13 +1414,15 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
ngModuleRef1.injector.get(Bar);
|
||||
|
||||
// Tree Shakeable provider definition should get added to the NgModule data.
|
||||
const providerDef1 = (ngModuleRef1 as NgModuleData)._def.providersByKey[tokenKey(Bar)];
|
||||
const providerDef1 =
|
||||
(ngModuleRef1 as NgModuleData)._def.providersByKey[tokenKey(Bar)];
|
||||
expect(providerDef1).not.toBeUndefined();
|
||||
|
||||
// Instantiate the same module. The tree shakeable provider
|
||||
// definition should not already be present.
|
||||
const ngModuleRef2 = factory.create(null);
|
||||
const providerDef2 = (ngModuleRef2 as NgModuleData)._def.providersByKey[tokenKey(Bar)];
|
||||
const providerDef2 =
|
||||
(ngModuleRef2 as NgModuleData)._def.providersByKey[tokenKey(Bar)];
|
||||
expect(providerDef2).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
fixmeIvy('unknown') && describe('projection', () => {
|
||||
describe('projection', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({declarations: [MainComp, OtherComp, Simple]}));
|
||||
|
||||
it('should support simple components', () => {
|
||||
@ -82,7 +82,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('');
|
||||
});
|
||||
|
||||
it('should support multiple content tags', () => {
|
||||
fixmeIvy('unknown') && it('should support multiple content tags', () => {
|
||||
TestBed.configureTestingModule({declarations: [MultipleContentTagsComponent]});
|
||||
TestBed.overrideComponent(MainComp, {
|
||||
set: {
|
||||
@ -113,6 +113,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('(, BAC)');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should redistribute direct child viewcontainers when the light dom changes', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [MultipleContentTagsComponent, ManualViewportDirective]});
|
||||
@ -156,6 +157,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('OUTER(SIMPLE(AB))');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should support nesting with content being direct child of a nested component', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations:
|
||||
@ -173,8 +175,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
const main = TestBed.createComponent(MainComp);
|
||||
|
||||
const viewportDirective =
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
|
||||
ManualViewportDirective);
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0]
|
||||
.injector.get(ManualViewportDirective);
|
||||
|
||||
expect(main.nativeElement).toHaveText('OUTER(INNER(INNERINNER(,BC)))');
|
||||
viewportDirective.show();
|
||||
@ -182,7 +184,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('OUTER(INNER(INNERINNER(A,BC)))');
|
||||
});
|
||||
|
||||
it('should redistribute when the shadow dom changes', () => {
|
||||
fixmeIvy('unknown') && it('should redistribute when the shadow dom changes', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [ConditionalContentComponent, ManualViewportDirective]});
|
||||
TestBed.overrideComponent(MainComp, {
|
||||
@ -237,6 +239,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('P,text');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should support moving non projected light dom around', () => {
|
||||
let sourceDirective: ManualViewportDirective = undefined !;
|
||||
|
||||
@ -267,7 +270,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('START(A)END');
|
||||
});
|
||||
|
||||
it('should support moving projected light dom around', () => {
|
||||
fixmeIvy('unknown') && it('should support moving projected light dom around', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [Empty, ProjectDirective, ManualViewportDirective]});
|
||||
TestBed.overrideComponent(MainComp, {
|
||||
@ -290,9 +293,12 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('SIMPLE()START(A)END');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should support moving ng-content around', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [ConditionalContentComponent, ProjectDirective, ManualViewportDirective]});
|
||||
TestBed.configureTestingModule({
|
||||
declarations:
|
||||
[ConditionalContentComponent, ProjectDirective, ManualViewportDirective]
|
||||
});
|
||||
TestBed.overrideComponent(MainComp, {
|
||||
set: {
|
||||
template: '<conditional-content>' +
|
||||
@ -305,8 +311,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
const main = TestBed.createComponent(MainComp);
|
||||
|
||||
const sourceDirective: ManualViewportDirective =
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
|
||||
ManualViewportDirective);
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0]
|
||||
.injector.get(ManualViewportDirective);
|
||||
const projectDirective: ProjectDirective =
|
||||
main.debugElement.queryAllNodes(By.directive(ProjectDirective))[0].injector.get(
|
||||
ProjectDirective);
|
||||
@ -324,6 +330,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
// Note: This does not use a ng-content element, but
|
||||
// is still important as we are merging proto views independent of
|
||||
// the presence of ng-content elements!
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should still allow to implement a recursive trees', () => {
|
||||
TestBed.configureTestingModule({declarations: [Tree, ManualViewportDirective]});
|
||||
TestBed.overrideComponent(MainComp, {set: {template: '<tree></tree>'}});
|
||||
@ -331,8 +338,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
main.detectChanges();
|
||||
const manualDirective: ManualViewportDirective =
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
|
||||
ManualViewportDirective);
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[0]
|
||||
.injector.get(ManualViewportDirective);
|
||||
expect(main.nativeElement).toHaveText('TREE(0:)');
|
||||
manualDirective.show();
|
||||
main.detectChanges();
|
||||
@ -342,6 +349,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
// Note: This does not use a ng-content element, but
|
||||
// is still important as we are merging proto views independent of
|
||||
// the presence of ng-content elements!
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should still allow to implement a recursive trees via multiple components', () => {
|
||||
TestBed.configureTestingModule({declarations: [Tree, Tree2, ManualViewportDirective]});
|
||||
TestBed.overrideComponent(MainComp, {set: {template: '<tree></tree>'}});
|
||||
@ -361,7 +369,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
expect(main.nativeElement).toHaveText('TREE(0:TREE2(1:))');
|
||||
|
||||
const tree2 = main.debugElement.query(By.directive(Tree2));
|
||||
manualDirective = tree2.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
|
||||
manualDirective =
|
||||
tree2.queryAllNodes(By.directive(ManualViewportDirective))[0].injector.get(
|
||||
ManualViewportDirective);
|
||||
manualDirective.show();
|
||||
main.detectChanges();
|
||||
@ -427,6 +436,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
});
|
||||
}
|
||||
|
||||
fixmeIvy('FW-665: Unable to find the given context data for the given target') &&
|
||||
it('should support nested conditionals that contain ng-contents', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [ConditionalTextComponent, ManualViewportDirective]});
|
||||
@ -441,11 +451,13 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
viewportElement.injector.get(ManualViewportDirective).show();
|
||||
expect(main.nativeElement).toHaveText('MAIN(FIRST())');
|
||||
|
||||
viewportElement = main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[1];
|
||||
viewportElement =
|
||||
main.debugElement.queryAllNodes(By.directive(ManualViewportDirective))[1];
|
||||
viewportElement.injector.get(ManualViewportDirective).show();
|
||||
expect(main.nativeElement).toHaveText('MAIN(FIRST(SECOND(a)))');
|
||||
});
|
||||
|
||||
fixmeIvy('unknown') &&
|
||||
it('should allow to switch the order of nested components via ng-content', () => {
|
||||
TestBed.configureTestingModule({declarations: [CmpA, CmpB, CmpD, CmpC]});
|
||||
TestBed.overrideComponent(MainComp, {set: {template: `<cmp-a><cmp-b></cmp-b></cmp-a>`}});
|
||||
@ -458,7 +470,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
'<cmp-c><b>cmp-c</b></cmp-c></cmp-a>');
|
||||
});
|
||||
|
||||
it('should create nested components in the right order', () => {
|
||||
fixmeIvy('unknown') && it('should create nested components in the right order', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [CmpA1, CmpA2, CmpB11, CmpB12, CmpB21, CmpB22]});
|
||||
TestBed.overrideComponent(MainComp, {set: {template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`}});
|
||||
@ -471,7 +483,7 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
'<cmp-a2>a2<cmp-b21>b21</cmp-b21><cmp-b22>b22</cmp-b22></cmp-a2>');
|
||||
});
|
||||
|
||||
it('should project filled view containers into a view container', () => {
|
||||
fixmeIvy('unknown') && it('should project filled view containers into a view container', () => {
|
||||
TestBed.configureTestingModule(
|
||||
{declarations: [ConditionalContentComponent, ManualViewportDirective]});
|
||||
TestBed.overrideComponent(MainComp, {
|
||||
|
@ -14,8 +14,8 @@ import {Subject} from 'rxjs';
|
||||
|
||||
import {stringify} from '../../src/util';
|
||||
|
||||
{
|
||||
fixmeIvy('unknown') && describe('Query API', () => {
|
||||
// FW-670: Internal Error: The name q is already defined in scope
|
||||
fixmeIvy('FW-670') && describe('Query API', () => {
|
||||
|
||||
beforeEach(() => TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
@ -66,8 +66,7 @@ import {stringify} from '../../src/util';
|
||||
});
|
||||
|
||||
it('should contain all direct child directives in the content dom', () => {
|
||||
const template =
|
||||
'<needs-content-children #q><div text="foo"></div></needs-content-children>';
|
||||
const template = '<needs-content-children #q><div text="foo"></div></needs-content-children>';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
|
||||
const q = view.debugElement.children[0].references !['q'];
|
||||
@ -232,8 +231,7 @@ import {stringify} from '../../src/util';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
const needsTpl: NeedsTpl = view.debugElement.children[0].injector.get(NeedsTpl);
|
||||
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.query.first).rootNodes[0])
|
||||
.toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.query.first).rootNodes[0]).toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.viewQuery.first).rootNodes[0])
|
||||
.toHaveText('shadow');
|
||||
});
|
||||
@ -243,8 +241,7 @@ import {stringify} from '../../src/util';
|
||||
'<needs-named-tpl><ng-template #tpl><div>light</div></ng-template></needs-named-tpl>';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
const needsTpl: NeedsNamedTpl = view.debugElement.children[0].injector.get(NeedsNamedTpl);
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.contentTpl).rootNodes[0])
|
||||
.toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.contentTpl).rootNodes[0]).toHaveText('light');
|
||||
expect(needsTpl.vc.createEmbeddedView(needsTpl.viewTpl).rootNodes[0]).toHaveText('shadow');
|
||||
});
|
||||
});
|
||||
@ -286,7 +283,19 @@ import {stringify} from '../../src/util';
|
||||
'</needs-content-child-template-ref-app>';
|
||||
const view = createTestCmp(MyComp0, template);
|
||||
|
||||
// can't execute checkNoChanges as our view modifies our content children (via a query).
|
||||
// can't
|
||||
// execute
|
||||
// checkNoChanges
|
||||
// as
|
||||
// our
|
||||
// view
|
||||
// modifies
|
||||
// our
|
||||
// content
|
||||
// children
|
||||
// (via
|
||||
// a
|
||||
// query).
|
||||
view.detectChanges(false);
|
||||
expect(view.nativeElement).toHaveText('OUTER');
|
||||
});
|
||||
@ -344,8 +353,7 @@ import {stringify} from '../../src/util';
|
||||
|
||||
it('should correctly clean-up when destroyed together with the directives it is querying',
|
||||
() => {
|
||||
const template =
|
||||
'<needs-query #q *ngIf="shouldShow"><div text="foo"></div></needs-query>';
|
||||
const template = '<needs-query #q *ngIf="shouldShow"><div text="foo"></div></needs-query>';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
view.componentInstance.shouldShow = true;
|
||||
view.detectChanges();
|
||||
@ -526,7 +534,15 @@ import {stringify} from '../../src/util';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
const q: NeedsViewQueryOrder = view.debugElement.children[0].references !['q'];
|
||||
|
||||
// no significance to 50, just a reasonably large cycle.
|
||||
// no
|
||||
// significance
|
||||
// to
|
||||
// 50,
|
||||
// just
|
||||
// a
|
||||
// reasonably
|
||||
// large
|
||||
// cycle.
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const newString = i.toString();
|
||||
q.list = [newString];
|
||||
@ -563,8 +579,21 @@ import {stringify} from '../../src/util';
|
||||
expect(q.query.length).toBe(0);
|
||||
});
|
||||
|
||||
// Note: This tests is just document our current behavior, which we do
|
||||
// for performance reasons.
|
||||
// Note:
|
||||
// This
|
||||
// tests
|
||||
// is
|
||||
// just
|
||||
// document
|
||||
// our
|
||||
// current
|
||||
// behavior,
|
||||
// which
|
||||
// we
|
||||
// do
|
||||
// for
|
||||
// performance
|
||||
// reasons.
|
||||
it('should not affected queries for projected templates if views are detached or moved', () => {
|
||||
const template =
|
||||
'<manual-projecting #q><ng-template let-x="x"><div [text]="x"></div></ng-template></manual-projecting>';
|
||||
@ -614,11 +643,15 @@ import {stringify} from '../../src/util';
|
||||
@Component(
|
||||
{selector: 'auto-projecting', template: '<div *ngIf="true; then: content"></div>'})
|
||||
class AutoProjecting {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
// TODO(issue/24571):
|
||||
// remove
|
||||
// '!'.
|
||||
@ContentChild(TemplateRef)
|
||||
content !: TemplateRef<any>;
|
||||
|
||||
// TODO(issue/24571): remove '!'.
|
||||
// TODO(issue/24571):
|
||||
// remove
|
||||
// '!'.
|
||||
@ContentChildren(TextDirective)
|
||||
query !: QueryList<TextDirective>;
|
||||
}
|
||||
@ -629,14 +662,23 @@ import {stringify} from '../../src/util';
|
||||
const view = createTestCmpAndDetectChanges(MyComp0, template);
|
||||
|
||||
const q = view.debugElement.children[0].references !['q'];
|
||||
// This should be 1, but due to
|
||||
// https://github.com/angular/angular/issues/15117 this is 0.
|
||||
// This
|
||||
// should
|
||||
// be
|
||||
// 1,
|
||||
// but
|
||||
// due
|
||||
// to
|
||||
// https://github.com/angular/angular/issues/15117
|
||||
// this
|
||||
// is
|
||||
// 0.
|
||||
expect(q.query.length).toBe(0);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Directive({selector: '[text]', inputs: ['text'], exportAs: 'textDir'})
|
||||
class TextDirective {
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, ApplicationRef, Component, ComponentRef, ContentChild, Directive, ErrorHandler, EventEmitter, HostListener, InjectionToken, Injector, Input, NgModule, NgModuleRef, NgZone, Output, Pipe, PipeTransform, Provider, QueryList, Renderer2, SimpleChanges, TemplateRef, ViewChildren, ViewContainerRef, destroyPlatform, ɵivyEnabled as ivyEnabled} from '@angular/core';
|
||||
import {TestBed, async, fakeAsync, inject, tick} from '@angular/core/testing';
|
||||
import {TestBed, fakeAsync, inject, tick} from '@angular/core/testing';
|
||||
import {BrowserModule, By, DOCUMENT} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
@ -16,11 +16,10 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
|
||||
{
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
declareTestsUsingBootstrap();
|
||||
@ -35,7 +34,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
describe('platform pipes', () => {
|
||||
beforeEach(() => { TestBed.configureCompiler({...config}); });
|
||||
|
||||
it('should overwrite them by custom pipes', () => {
|
||||
fixmeIvy('unknown') && it('should overwrite them by custom pipes', () => {
|
||||
TestBed.configureTestingModule({declarations: [CustomPipe]});
|
||||
const template = '{{true | somePipe}}';
|
||||
TestBed.overrideComponent(MyComp1, {set: {template}});
|
||||
@ -77,7 +76,9 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(CountingPipe.calls).toBe(1);
|
||||
});
|
||||
|
||||
it('should only update the bound property when using asyncPipe - #15205', fakeAsync(() => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should only update the bound property when using asyncPipe - #15205',
|
||||
fakeAsync(() => {
|
||||
@Component({template: '<div myDir [a]="p | async" [b]="2"></div>'})
|
||||
class MyComp {
|
||||
p = Promise.resolve(1);
|
||||
@ -99,7 +100,8 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
|
||||
TestBed.configureTestingModule({declarations: [MyDir, MyComp]});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
const dir = fixture.debugElement.query(By.directive(MyDir)).injector.get(MyDir) as MyDir;
|
||||
const dir =
|
||||
fixture.debugElement.query(By.directive(MyDir)).injector.get(MyDir) as MyDir;
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(dir.setterCalls).toEqual({'a': null, 'b': 2});
|
||||
@ -160,6 +162,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get(token)).toEqual(tokenValue);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-646: Directive providers don\'t support primitive types as DI tokens') &&
|
||||
it('should support providers with string token with a `.` in it', () => {
|
||||
const token = 'a.b';
|
||||
const tokenValue = 1;
|
||||
@ -188,6 +191,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(injector.get(token2)).toEqual(tokenValue2);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-646: Directive providers don\'t support primitive types as DI tokens') &&
|
||||
it('should support providers that have a `name` property with a number value', () => {
|
||||
class TestClass {
|
||||
constructor(public name: number) {}
|
||||
@ -333,7 +337,7 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(fixture.debugElement.childNodes.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should allow empty embedded templates', () => {
|
||||
fixmeIvy('unknown') && it('should allow empty embedded templates', () => {
|
||||
@Component({template: '<ng-template [ngIf]="true"></ng-template>'})
|
||||
class MyComp {
|
||||
}
|
||||
@ -350,7 +354,9 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
});
|
||||
});
|
||||
|
||||
it('should support @ContentChild and @Input on the same property for static queries', () => {
|
||||
fixmeIvy('unknown') &&
|
||||
it('should support @ContentChild and @Input on the same property for static queries',
|
||||
() => {
|
||||
@Directive({selector: 'test'})
|
||||
class Test {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
|
@ -16,9 +16,8 @@ import {fixmeIvy} from '@angular/private/testing';
|
||||
if (ivyEnabled) {
|
||||
fixmeIvy('unknown') && describe('ivy', () => { declareTests(); });
|
||||
} else {
|
||||
fixmeIvy('unknown') && describe('jit', () => { declareTests({useJit: true}); });
|
||||
|
||||
fixmeIvy('unknown') && describe('no jit', () => { declareTests({useJit: false}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user