Skip to content

test(frontend): extend UserProjectListItemComponent template coverage - #7418

Merged
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7410-user-project-list-item-template
Aug 8, 2026
Merged

test(frontend): extend UserProjectListItemComponent template coverage#7418
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7410-user-project-list-item-template

Conversation

@mengw15

@mengw15 mengw15 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Rebased onto main after #7415 landed on the same file, and reduced to what that
PR left uncovered. #7415 pins what each template branch looks like by putting the
component into the state directly; this PR pins the wiring that produces those
states, so a control losing its handler fails here. Together they take
user-project-list-item.component.html to 100% (110/110 statements, no uncovered
branches — it was 77/110 after #7415).

8 new tests:

  • colour panel — the [(colorPicker)] / (colorPickerSelect) outputs, and the
    cpExtraTemplate menu, whose markup exists only while the picker is open: its
    Save action, and its Delete action in both states (disabled while the project has
    no colour, enabled and wired once one is set). None of this was previously
    rendered — it is the bulk of the gap extend UserProjectListItemComponent template coverage #7410 describes.
  • name — the edit button opens the input, keyup.enter saves, focusout closes.
  • description — the expand/collapse controls, the edit button, focusout
    saving, and the suffix save icon closing the editor.
  • actions — the share button and the delete popconfirm's nzOnConfirm.
  • three class-level gaps: the entry getter's guard, ngOnInit adopting a stored
    colour, and updateProjectColor skipping the service when the colour is
    unchanged (class 63/67 -> 66/67).

This block queries with By.css + triggerEventHandler rather than
querySelector: nzOnConfirm, keyup.enter and colorPickerSelect are directive
outputs, not DOM events, so a native dispatch cannot reach them. #7415's
MarkdownModule.forRoot() is kept as-is. No production code was changed.

Tests that #7415 already covers (the creation date, the editable gating, the
read-only delete branch) were dropped from this PR rather than duplicated.

One statement stays uncovered: the if (!this.entry) throw guard inside
saveProjectName's subscribe. The entry getter already throws when no entry was
provided, so that branch cannot be reached — it is dead code rather than a coverage
gap, and removing it felt out of scope for a test-only PR.

Any related issues, documentation, discussions?

Closes #7410. Builds on #7415 (#7412), which covers the same template from the
rendering side.

How was this PR tested?

ng test --watch=false --include src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts
— 28 passed (20 existing + 8 new), run 3x for determinism. Coverage (--coverage)
confirms user-project-list-item.component.html at 110/110 statements with no
uncovered branches, and the class at 66/67. The failure path was verified by
breaking an assertion (red, non-zero exit); eslint and prettier are clean.

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

Generated-by: Claude Code (Opus 4.8 [1M context])

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

github-actions Bot commented Aug 8, 2026

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: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan 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

This PR extends the frontend unit tests for UserProjectListItemComponent to exercise previously unrendered template branches (e.g., color picker panel actions, editable name/description modes, action buttons), aiming to bring the component template to full coverage without changing production code.

Changes:

  • Adds DOM-driven tests to cover color picker interactions (including the cpExtraTemplate Save/Delete actions).
  • Adds tests for name/description edit flows (enter-to-save, focusout behavior, expand/collapse rendering).
  • Adds tests for action buttons (share, delete confirm, read-only disabled branch, non-editable hidden-UI branch) and a few newly reachable class branches.
Suppressed comments (2)

frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:302

  • q(".edit-name-icon").parent! relies on a non-null assertion and will fail with a generic runtime error if the icon/button is missing. Prefer an explicit error so test failures are actionable when the template structure changes.
      q(".edit-name-icon").parent!.triggerEventHandler("click", null);

frontend/src/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts:333

  • q(".edit-description-icon").parent! relies on a non-null assertion and will fail with a generic runtime error if the icon/button is missing. Prefer an explicit error so failures clearly indicate what element was not found.
      q(".edit-description-icon").parent!.triggerEventHandler("click", null);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

codecov-commenter commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.17%. Comparing base (97dac3c) to head (fc81f9d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7418      +/-   ##
============================================
+ Coverage     85.12%   85.17%   +0.05%     
  Complexity     4152     4152              
============================================
  Files          1169     1169              
  Lines         46740    46740              
  Branches       5202     5202              
============================================
+ Hits          39788    39812      +24     
+ Misses         5237     5216      -21     
+ Partials       1715     1712       -3     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 97dac3c
agent-service 85.50% <ø> (ø) Carriedforward from 97dac3c
amber 80.89% <ø> (ø) Carriedforward from 97dac3c
computing-unit-managing-service 50.72% <ø> (ø) Carriedforward from 97dac3c
config-service 65.97% <ø> (ø) Carriedforward from 97dac3c
file-service 69.05% <ø> (ø) Carriedforward from 97dac3c
frontend 87.50% <ø> (+0.11%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 97dac3c
pyamber 97.55% <ø> (ø) Carriedforward from 97dac3c
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 97dac3c

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15
mengw15 force-pushed the chore/7410-user-project-list-item-template branch from 14e7794 to 128c2ab Compare August 8, 2026 02:21
@mengw15
mengw15 requested a review from aglinxinyuan August 8, 2026 02:22
@mengw15
mengw15 force-pushed the chore/7410-user-project-list-item-template branch from 128c2ab to fc81f9d Compare August 8, 2026 11:22
@mengw15
mengw15 added this pull request to the merge queue Aug 8, 2026
Merged via the queue into apache:main with commit 3534662 Aug 8, 2026
26 checks passed
@mengw15
mengw15 deleted the chore/7410-user-project-list-item-template branch August 8, 2026 12:04
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.

extend UserProjectListItemComponent template coverage

4 participants