fix(view_manager): allow to create host views even if there is an embedded view at the same place.
This commit is contained in:
parent
b785503543
commit
116b64de25
|
@ -188,7 +188,8 @@ export class AppViewManager {
|
||||||
|
|
||||||
var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex);
|
var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex);
|
||||||
var view;
|
var view;
|
||||||
if (isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) {
|
if (protoView.type === ViewType.EMBEDDED && isPresent(embeddedFragmentView) &&
|
||||||
|
!embeddedFragmentView.hydrated()) {
|
||||||
// Case 1: instantiate the first view of a template that has been merged into a parent
|
// Case 1: instantiate the first view of a template that has been merged into a parent
|
||||||
view = embeddedFragmentView;
|
view = embeddedFragmentView;
|
||||||
this._attachRenderView(parentView, boundElementIndex, atIndex, view);
|
this._attachRenderView(parentView, boundElementIndex, atIndex, view);
|
||||||
|
|
|
@ -300,6 +300,22 @@ export function main() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('create a host view', () => {
|
||||||
|
|
||||||
|
it('should always create a new view and not use the embedded view', () => {
|
||||||
|
var newHostPv = createHostPv([createNestedElBinder(createComponentPv())]);
|
||||||
|
var newHostView =
|
||||||
|
internalView(manager.createViewInContainer(vcRef, 0, wrapPv(newHostPv), null));
|
||||||
|
expect(newHostView.proto).toBe(newHostPv);
|
||||||
|
expect(newHostView).not.toBe(hostView.views[2]);
|
||||||
|
expect(viewListener.spy('viewCreated')).toHaveBeenCalledWith(newHostView);
|
||||||
|
expect(renderer.spy('createView'))
|
||||||
|
.toHaveBeenCalledWith(newHostPv.mergeMapping.renderProtoViewRef,
|
||||||
|
newHostPv.mergeMapping.renderFragmentCount);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue