Skip to content

Recover the agent panel template's coverage by rendering its real children #7628

Closed

Description

@aglinxinyuan

Task Summary

frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.html reports 0 of 49 lines covered, while its own .component.ts sits at 133/133 with nothing missed. That pairing cannot come from undertesting — this is one of the better-tested templates in the frontend, with roughly 42 tests behind it. It can only come from attribution loss.

The cause is issue #7458: the spec stubs its child components out with TestBed.overrideComponent, and any override makes Angular re-JIT the component from its retained decorator metadata. The re-compiled template function carries no source map back to the .html, so every binding still executes and none of it is attributed.

The remedy is proven — merged PR #7535 applied it to hub-workflow-detail.component.html (0/46 → 45/46). Append a new describe block that configures its own TestBed with no override, imports the real children, satisfies their DI, and asserts on the rendered DOM. Leave the existing tests and their stubs alone.

Because the existing tests are already strong, the new block should target what they cannot reach through the class: rendered structure, and the branches the template itself decides.

Two traps specific to this component, both of which produce a test that cannot fail:

  1. The registration tab is the selected tab. Asserting its body renders proves nothing about [nzForceRender], because a selected tab renders either way. Select an agent tab first, then the registration body is present only if it is force-rendered.
  2. selectedTabIndex starts at 0 and activateAgent starts un-called. A close-button test that asserts both from that starting state holds even with event.stopPropagation() deleted. Start on the agent's own tab so a propagated click would move something.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Activity

  1. added a commit that references this issue on Aug 14, 2026
    379208e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions