fix(projection): allow more bound render elements than app elements.
Fixes #3236 Closes #3247
This commit is contained in:
@ -74,7 +74,7 @@ export function main() {
|
||||
renderCompiler.spy('mergeProtoViewsRecursively')
|
||||
.andCallFake((protoViewRefs: List<renderApi.RenderProtoViewRef | List<any>>) => {
|
||||
return PromiseWrapper.resolve(new renderApi.RenderProtoViewMergeMapping(
|
||||
new MergedRenderProtoViewRef(protoViewRefs), 1, [], [], [], [null]));
|
||||
new MergedRenderProtoViewRef(protoViewRefs), 1, [], 0, [], [], [null]));
|
||||
});
|
||||
// TODO spy on .compile and return RenderProtoViewRef, same for compileHost
|
||||
rootProtoView = createRootProtoView(directiveResolver, MainComponent);
|
||||
|
@ -92,6 +92,26 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('should support projecting text interpolation to a non bound element with other bound elements after it',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(Simple, new viewAnn.View({
|
||||
template: 'SIMPLE(<div><ng-content></ng-content></div><div [tab-index]="0">EL</div>)',
|
||||
directives: []
|
||||
}))
|
||||
.overrideView(
|
||||
MainComp,
|
||||
new viewAnn.View({template: '<simple>{{text}}</simple>', directives: [Simple]}))
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
|
||||
main.componentInstance.text = 'A';
|
||||
main.detectChanges();
|
||||
expect(main.nativeElement).toHaveText('SIMPLE(AEL)');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not show the light dom even if there is no content tag',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(MainComp,
|
||||
|
@ -324,9 +324,10 @@ function _createProtoView(type: ViewType, binders: ElementBinder[] = null) {
|
||||
}
|
||||
var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(res);
|
||||
if (type === ViewType.EMBEDDED || type === ViewType.HOST) {
|
||||
res.mergeMapping = new AppProtoViewMergeMapping(new RenderProtoViewMergeMapping(
|
||||
null, hostElementIndicesByViewIndex.length, mappedElementIndices, [],
|
||||
hostElementIndicesByViewIndex, countNestedProtoViews(res)));
|
||||
res.mergeMapping = new AppProtoViewMergeMapping(
|
||||
new RenderProtoViewMergeMapping(null, hostElementIndicesByViewIndex.length,
|
||||
mappedElementIndices, mappedElementIndices.length, [],
|
||||
hostElementIndicesByViewIndex, countNestedProtoViews(res)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user