mengw15 commented on code in PR #5037:
URL: https://github.com/apache/texera/pull/5037#discussion_r3237975036
##########
frontend/src/app/workspace/component/workspace.component.spec.ts:
##########
@@ -359,4 +372,29 @@ describe("WorkspaceComponent", () => {
expect(component.copilotEnabled).toBe(false);
});
});
+
+ // Real-template rendering coverage — previously the spec replaced the entire
+ // template with `<div #codeEditor>` to keep the heavyweight children out of
+ // the test build, which meant editor lifecycle wiring went untested. With
+ // only the child IMPORTS now stripped (template intact), the real
+ // `<ng-template #codeEditor>` outlet renders and the @ViewChild query
+ // resolves to a live ViewContainerRef. See #5015.
+ describe("child rendering side effects", () => {
+ it("publishes the resolved ViewContainerRef to CodeEditorService.vc on
view init", async () => {
+ await createFixture();
+ // Before view init nothing has been assigned. (The pre-fixture stub on
+ // codeEditorViewRef in createFixture only protects ngOnDestroy teardown
+ // — the service.vc should still be untouched.)
+ expect(codeEditorService.vc).toBeUndefined();
+ fixture.detectChanges();
+ // ngAfterViewInit should hand the live ViewContainerRef from the real
+ // <ng-template #codeEditor> through to CodeEditorService — and not the
+ // pre-test stub. Real ViewContainerRefs expose createEmbeddedView; the
+ // stub does not, so its presence proves the @ViewChild query resolved
+ // against the rendered template rather than the placeholder.
Review Comment:
This overlaps a lot with the describe-block comment above. Could be
tightened to focus just on the assertion strategy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]