Skip to content

Drive the workspace menu template through the DOM instead of calling its handlers #7837

Closed

Description

@mengw15

Task Summary

menu.component.html has 75 uncovered template lines at 66.81%, while its component class sits at 86.27%. The spec is mature — 62 it() blocks — but calls detectChanges() only 6 times, so it exercises the handlers directly and almost never renders the markup that invokes them. Goal: bring the template toward full coverage by driving it through the DOM.

Vitest/jsdom; see frontend/TESTING.md and frontend/AGENTS.md.

Behavior to add

MenuComponent template (frontend/src/app/workspace/component/menu/menu.component.html, codecov 66.81 %, EXTEND menu.component.spec.ts)

The mechanics that apply throughout: call fixture.detectChanges() after every state change, query with fixture.debugElement.query(By.css(...)) and fire .triggerEventHandler("click", null) rather than calling the method on the instance, and seed the inputs/service state each *ngIf needs so its arm renders. Run the local coverage report to catch whatever is left after the clusters below — treat this list as a map of where the red lines are, not as a fence.

The uncovered lines fall into five groups:

  • Version-display bar (lines 25–79) — the whole displayParticularWorkflowVersion branch never renders: the close button, revertToVersion() / cloneVersion() with their [disabled]="!workflowVersionService.canRestoreVersion" guard, the Current Version: {{ … }} label, and the *ngFor over coeditor icons. Set the version service's displayParticularWorkflowVersion and selectedDisplayedVersionId, render, then assert both the enabled and disabled states of the restore button.
  • Toolbar click bindings (98, 106, 116, 125, 133) — onClickCreateNewWorkflow(), persistWorkflow(), onClickDeleteAllOperators(), onClickExportWorkflow(), onClickEditDescription() are only ever called directly. Spy on each and fire the click from the rendered button.
  • View-toggle switches (169–194) — showGrid / showRegion / showNumWorkers / showStatus and their (ngModelChange) handlers toggleGrid() / toggleRegion() / toggleNumWorkers() / toggleStatus(). Drive them through the switch element so both the binding and the handler run.
  • Operator context menu (253–333) — onClickExportExecutionResult(), operatorMenu.disableHighlightedOperators(), viewResultHighlightedOperators(), reuseResultHighlightedOperator(), and undoRedoService.undoAction() / redoAction(). Each has a [disabled] guard (isDisableOperatorClickable, isToViewResultClickable, isReuseResultClickable); cover both sides by highlighting an operator and by leaving the selection empty.
  • Execution settings popover and status footer (375–448) — handleCheckpoint() with [disabled]="executionState !== ExecutionState.Paused", the currentExecutionName input gated on isWorkflowModifiable, the email-notification switch bound to config.env.workflowEmailNotificationEnabled, and the connected/disconnected footer including the *ngIf="workflowWebsocketService.isConnected" block that shows the computing-unit status and worker count. Toggle the websocket service's isConnected and the computing-unit state so both arms render.

Determinism constraints for this file:

  • Do not assert on layout or geometry — getBoundingClientRect / scrollHeight return zeros under jsdom.
  • Do not assert on DatePipe-rendered text; a fixed epoch renders a different day under a UTC runner. Rendering it is fine, asserting the string is not.
  • fixture.destroy() in afterEach so any @UntilDestroy subscription stops between tests, and vi.restoreAllMocks() so spies do not leak.

Out of scope: anything requiring a real backend — use HttpClientTestingModule and flush synchronously, or stub the services with of(...).

Note there are open PRs touching this component (#7463 removes the deprecated project feature, #6213 and #4270 add toolbar entries), so rebase before finishing and do not build assertions around project-specific menu items.

Task Type

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

Activity

  1. added theissue type on Aug 22, 2026
  2. self-assigned this
    on Aug 22, 2026
  3. added a commit that references this issue on Aug 22, 2026
    fb7f33b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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