Skip to content

test(frontend): render the dashboard search with its real children - #7627

Open
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:cov/search-render
Open

test(frontend): render the dashboard search with its real children#7627
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:cov/search-render

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

search.component.html reported 0 of 35 lines covered while its own .ts sat at 93%. That is the attribution loss from #7458, not an untested template: the spec stubs its children out through TestBed.overrideComponent, and any override re-JITs the component from its decorator metadata, so the re-compiled template has no source map back to the .html and its bindings execute uncounted.

Adds a describe block that renders the component with its real children, which restores attribution:

Before After
search.component.html lines 0/35 35/35
search.component.html functions 0/6 6/6
search.component.ts lines 52/56 55/56
search.component.ts branches 19/23 21/23

The block keeps its own TestBed, so the 15 existing tests keep their stubs and assertions untouched. Same remedy as merged PR #7535.

Verification

16 mutations applied and reverted, production diff empty each time. Five were then run independently, chosen against the failure modes rather than repeating the list:

Probe Result
drop [currentUid] from the child binding red — so the child-instance assertion is not the "collaborator also sets it" trap
(sortMethodChange) no longer assigns red
the All-type button unwired red
delete the Project button's nz-icon span red — which also proves nz-icon really derives its anticon-* class under jsdom
[showResourceTypes]="true""false" survives, and was reported as such

I ran a sixth of my own afterwards — unwiring the All-type button — and it is red.

Deliberately not included

[showResourceTypes] is reported rather than pinned: repo-wide grep shows the consuming component never varies it, so the flag has one value in practice and no assertion can distinguish the two.

No production file is touched.

Any related issues, documentation, discussions?

Closes #7626

How was this PR tested?

npx ng test --watch=false --include="**/search.component.spec.ts"
 Test Files  1 passed (1)
      Tests  22 passed (22)

7 new on top of the existing 15. Coverage re-measured from scratch by reverting the spec, running with --coverage, then restoring. yarn format:ci passes.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

search.component.html reported 0 of 35 lines covered while its own .ts sat
at 93%. That is not an untested template - it is the attribution loss
recorded in apache#7458: the spec stubs its children out through
TestBed.overrideComponent, and any override makes Angular re-JIT the
component from its decorator metadata, leaving the re-compiled template
with no source map back to the .html.

Adds a describe block that renders the component with its real children,
which restores attribution: the template goes from 0/35 to 35/35 lines and
6/6 functions, and the .ts rises too. The block keeps its own TestBed so
the 15 existing tests keep their stubs untouched.

No production file is touched.
Copilot AI lite review requested due to automatic review settings August 13, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @yangzhang75
    You can notify them by mentioning @yangzhang75 in a comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recover the dashboard search template's coverage by rendering its real children

3 participants