mengw15 opened a new pull request, #7335:
URL: https://github.com/apache/texera/pull/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])
   


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