The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-7335-cc8308740361324f7f129657dad6dc395abeeb1c
 has failed.
Run started by GitHub user mengw15 (triggered by mengw15).

Head commit for run:
3c8e0e4fb79ae67c3b439602f4d43810fdcf872e / Meng Wang <[email protected]>
test(frontend): cover ContextMenuComponent template menu-item click bindings 
(#7335)

### What changes were proposed in this PR?

Extends `ContextMenuComponent`'s spec to cover the template's menu-item
`(click)`
bindings. The class file is already at 100%, but the existing tests call
the
handlers directly and never render/click the menu, so the template sat
at ~54%.

13 added tests render the menu (setting the state each item's `*ngIf`
needs),
query the `<li nz-menu-item>` by its label via `By.css`, fire
`.triggerEventHandler("click", null)`, and assert the click reaches the
handler
the item declares — either the component method (`onCopy` / `onCut` /
`onPaste` /
`onDelete` / `onClickExportHighlightedExecutionResult`, spied) or the
injected
`OperatorMenuService` double (`disableHighlightedOperators`,
`viewResultHighlightedOperators`, `reuseResultHighlightedOperator`,
`executeUpToOperator`). Covers both variants of the toggle items
(disable/enable,
view/remove-view, reuse/remove-reusing) and both delete paths (operators
vs
links-only).

This lifts `context-menu.component.html` from ~54% to **97.92%**. The
single
remaining line is the hardcoded-`nzDisabled` "reuse result" item's
`(click)`:
a disabled `nz-menu-item` genuinely swallows the click (verified —
clicking it
does not invoke the handler), so rather than force an unrealistic
interaction the
test only asserts that item renders; its handler is identical to
"remove reusing result", which is clicked and covered.

No production code was changed.

### Any related issues, documentation, discussions?

Closes #7332

### How was this PR tested?

Extended unit tests, run locally in `frontend/`:

```
ng test --watch=false --include 
src/app/workspace/component/workflow-editor/context-menu/context-menu/context-menu.component.spec.ts
# Test Files 1 passed (1) | Tests 42 passed (42)   — 3 consecutive runs, 0 
flakes
# context-menu.component.html: ~54% -> 97.92%
prettier --write <spec>   # formatted
eslint  <spec>            # clean
```

The failure path was verified by deliberately breaking a new assertion
and
confirming the suite exits non-zero.

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

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

Report URL: https://github.com/apache/texera/actions/runs/31119398757

With regards,
GitHub Actions via GitBox

Reply via email to