mengw15 opened a new pull request, #7336:
URL: https://github.com/apache/texera/pull/7336

   ### What changes were proposed in this PR?
   
   Extends `card-item.component.spec.ts` to render the previously-unexercised 
half
   of `card-item.component.html`. The class was already ~96% covered but the
   template sat at ~50% — the existing tests call the handlers directly rather 
than
   rendering the branches. This adds 8 tests that drive each template arm 
through
   the DOM (`detectChanges()` + 
`debugElement.query(By.css(...)).triggerEventHandler(...)`):
   
   - **Private-search mode** (workflow) — the checkbox overlay, edit-name 
button, and
     the Detail / Share / Copy / Download / Delete actions render and their 
clicks
     reach the right handler or `@Output`; the like button is absent here.
   - **Cover-image controls** (`canEditCover`) — the camera and reset buttons 
render
     and wire up, and the hidden file input's `(change)` fires.
   - **Name editing** — the edit button swaps the name display for the input, 
and
     Enter confirms the rename.
   - **Non-private mode** — the like button renders, toggles on click, shows the
     `liked` class, and is disabled without a current user.
   - **Dataset in private mode** — Download shows while Detail / Copy / 
checkbox are
     hidden (per-type `*ngIf` gating).
   - **Size row + cover-image error** handler.
   
   This takes the template from ~50% to **105/106 lines (99%)**. The one 
remaining
   line is the `(keydown.enter)` binding on the rename input: the handler is
   exercised (the test asserts the rename fires on Enter), but the coverage tool
   does not credit that key-filtered event line. No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7330.
   
   ### How was this PR tested?
   
   `ng test --watch=false --include 
src/app/dashboard/component/user/list-item/card-item/card-item.component.spec.ts`
 — 72 passed. `eslint` and `prettier --check` clean. Coverage report confirms 
the template at 105/106 lines. Failure path verified by breaking an assertion 
(→ non-zero exit) and restoring. Per the issue's determinism note, no 
`vi.useFakeTimers()` — `onEditName`'s `setTimeout` focus never runs in the 
synchronous test body.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
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]

Reply via email to