Skip to content

extend CardItemComponent template coverage #7330

Description

@mengw15

Task Summary

CardItemComponent's template is at ~50% (card-item.component.html, 51 uncovered lines) while its class file is already ~96%. The spec exercises the class but leaves half the template unrendered. Bring the template to full coverage. Vitest/jsdom; see frontend/TESTING.md.

Behavior to add

Extend card-item.component.spec.ts so each template branch renders, then run the coverage report and cover the remaining red lines. The uncovered constructs are *ngIf branches, (click) handlers and [(ngModel)] bindings — for example the selection checkbox (entry.checked) and its $event.stopPropagation() wrapper, and the per-entity-type blocks.

Approach:

  • fixture.detectChanges() after each state change (the template-coverage switch).
  • Trigger the bindings through the DOM — fixture.debugElement.query(By.css("...")) + .triggerEventHandler("click", ...) — instead of calling the handler methods directly.
  • Feed a DashboardEntry of each supported type (workflow / project / dataset / …) plus the flag combinations the template switches on (owned vs shared, liked vs not, editing vs display) so every *ngIf arm renders.

Determinism constraint: onEditName / onEditDescription queue a setTimeout that focuses the input (component L338 / L351). Do not add vi.useFakeTimers() just to suppress it — a synchronous test body never runs the callback, and layering fake timers over zone.js's patched timers is Node-version dependent and has caused CI-only failures. Assert editingName / the rendered input, not the focus.

Do not assert on layout/geometry under jsdom; assert on rendered text, element presence, and the state the binding writes.

Task Type

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

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