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

   ### What changes were proposed in this PR?
   
   Extends `list-item.component.spec.ts` so the card's controls are fired from 
the
   rendered markup instead of by calling the handlers directly. This takes
   `list-item.component.html` to full coverage. Measured locally with 
`--coverage`
   over the 15 specs that render `ListItemComponent`, so the figures line up 
with
   codecov's aggregate rather than with a single-spec run:
   
   | `list-item.component.html` | Before | After |
   | --- | --- | --- |
   | lines | 88/96 (91.67 %) | **96/96 (100 %)** |
   | branches | 7/10 | **10/10** |
   | functions | 3/17 | **17/17** |
   
   The eight lines the issue named — 99-105, 192, 201, 219/221, 231 — were 
exactly
   the ones uncovered before, and none is left.
   
   - **The inline rename input.** Clicking *Rename* renders it; typing writes 
back
     through `[(ngModel)]="entry.name"`; `(blur)` and `(keydown.enter)` each 
call
     `confirmUpdateCustomName` with the new name. Its
     `(click)="$event.stopPropagation()"` is fired too, so typing in the box 
cannot
     bubble to the row's `routerLink`.
   - **The action buttons.** *Detail*, *Share*, *Copy* and *Delete* are each 
fired
     from the rendered control. The delete confirmation is the popconfirm's
     `(nzOnConfirm)` output, which is bound on the button itself — the popup 
would
     need a CDK overlay, which jsdom never attaches, so the output is triggered
     directly and the comment says why.
   - **The download guard.** `*ngIf="entry.type === 'workflow' || entry.type 
=== 'dataset'"`
     is rendered for a workflow (and clicked), for a dataset, and for a third 
type
     where the button must be absent.
   - Also covered while the block was open: row hover, the per-row checkbox (its
     `(change)` and its `stopPropagation` guard), the description editor from 
both
     its button and the description line, and the public card's like button in 
both
     its disabled and enabled states.
   
   Every entry fixture is rebuilt per render, because `confirmUpdateCustomName`
   mutates `entry.name` in place. No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7963.
   
   The issue originally also covered `filters.component.html`; that half was 
dropped
   and the issue trimmed — all nine of its uncovered statements sit inside
   `<nz-dropdown-menu>`, whose content only exists once a CDK overlay attaches, 
and
   the overlay does not attach under jsdom (probed both by clicking the trigger 
and
   by driving `nzVisible` through `ngOnChanges` in `fakeAsync`). 
`filters.component.ts`
   is already at 100 %, and #7463 deletes the project dropdown that made up 
part of
   that half. The reasoning is recorded on the issue.
   
   ### How was this PR tested?
   
   `ng test --watch=false --include 
src/app/dashboard/component/user/list-item/list-item.component.spec.ts`
   — 45 passed (38 before, 7 new), repeated 3× for stability. The 15 specs that
   render `ListItemComponent` go from 435 to 442 passing, all green. `yarn 
format:ci`
   clean. Failure path verified by breaking one assertion in each of the 7 new 
tests:
   7 failed / 38 passed, non-zero exit, no pre-existing test disturbed, then 
restored
   to green.
   
   Determinism: every control is driven with `triggerEventHandler`, so nothing 
waits
   on a real event loop or an overlay; the modal-opening handlers are spied 
rather
   than allowed to open; `fixture.destroy()` and `vi.restoreAllMocks()` run in 
the
   block's `afterEach`; and no assertion touches rendered dates or geometry.
   
   ### 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