fix(ivy): taking "interpolation" config option into account (FW-723) (#27363)
PR Close #27363
This commit is contained in:

committed by
Igor Minar

parent
159788685a
commit
8e644d99fc
@ -132,6 +132,7 @@ export interface R3ComponentMetadataFacade extends R3DirectiveMetadataFacade {
|
||||
styles: string[];
|
||||
encapsulation: ViewEncapsulation;
|
||||
viewProviders: Provider[]|null;
|
||||
interpolation?: [string, string];
|
||||
}
|
||||
|
||||
export type ViewEncapsulation = number;
|
||||
|
@ -61,6 +61,7 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
||||
directives: [],
|
||||
pipes: new Map(),
|
||||
encapsulation: metadata.encapsulation || ViewEncapsulation.Emulated,
|
||||
interpolation: metadata.interpolation,
|
||||
viewProviders: metadata.viewProviders || null,
|
||||
};
|
||||
ngComponentDef = compiler.compileComponent(
|
||||
|
@ -1295,27 +1295,26 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(needsAttribute.fooAttribute).toBeNull();
|
||||
});
|
||||
|
||||
fixmeIvy('FW-723: Custom interpolation markers are not supported') &&
|
||||
it('should support custom interpolation', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
MyComp, ComponentWithCustomInterpolationA, ComponentWithCustomInterpolationB,
|
||||
ComponentWithDefaultInterpolation
|
||||
]
|
||||
});
|
||||
const template = `<div>{{ctxProp}}</div>
|
||||
it('should support custom interpolation', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
MyComp, ComponentWithCustomInterpolationA, ComponentWithCustomInterpolationB,
|
||||
ComponentWithDefaultInterpolation
|
||||
]
|
||||
});
|
||||
const template = `<div>{{ctxProp}}</div>
|
||||
<cmp-with-custom-interpolation-a></cmp-with-custom-interpolation-a>
|
||||
<cmp-with-custom-interpolation-b></cmp-with-custom-interpolation-b>`;
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
TestBed.overrideComponent(MyComp, {set: {template}});
|
||||
const fixture = TestBed.createComponent(MyComp);
|
||||
|
||||
fixture.componentInstance.ctxProp = 'Default Interpolation';
|
||||
fixture.componentInstance.ctxProp = 'Default Interpolation';
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement)
|
||||
.toHaveText(
|
||||
'Default InterpolationCustom Interpolation ACustom Interpolation B (Default Interpolation)');
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement)
|
||||
.toHaveText(
|
||||
'Default InterpolationCustom Interpolation ACustom Interpolation B (Default Interpolation)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dependency injection', () => {
|
||||
|
Reference in New Issue
Block a user