Compare commits

...

6 Commits

Author SHA1 Message Date
Connor Byrne
a34b807acd fix: remove unnecessary as any casts for nullable assignments
- `node.widgets = undefined` works since widgets is `IBaseWidget[] | undefined`
- `node.graph = null` works since graph is `LGraph | Subgraph | null`

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11149#discussion_r3187561906
2026-05-13 13:50:28 -07:00
bymyself
bbc9f4afb8 fix: narrow node.widgets type with non-null assertion
Fixes typecheck failure introduced in b949536e7 where the unconditional
expect(node.widgets).toHaveLength(1) assertion does not narrow the type
for the subsequent node.widgets[0].value access.

Uses the established codebase pattern (see LGraphNode.widgetOrder.test.ts)
of node.widgets! to assert non-null in tests.

Also picks up oxfmt whitespace normalization on two unrelated lines.
2026-05-13 13:43:58 -07:00
bymyself
7a29812aa5 fix: replace conditional guard with unconditional assertion
Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11149#discussion_r3117139533
2026-05-13 13:43:57 -07:00
bymyself
eab7974549 fix: add assertions to recreateWidget test
Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11149#discussion_r3117134964
2026-05-13 13:43:57 -07:00
bymyself
c334392daf refactor: extract makeWidget helper to avoid as any casts
Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/11149#discussion_r3117122698
2026-05-13 13:43:57 -07:00
bymyself
b110e61cef test: add unit tests for widgetInputs (0% → 90% coverage)
- PrimitiveNode class: applyToGraph, refreshComboInNode,
  onConnectionsChange, onConnectOutput, onLastDisconnect,
  onAfterGraphConfigured, recreateWidget
- Exported functions: getWidgetConfig, convertToInput,
  setWidgetConfig, mergeIfValid
- Extension registration: beforeRegisterNodeDef callbacks
  (convertWidgetToInput, onGraphConfigured, onConfigure,
  onInputDblClick), registerCustomNodes
- 47 behavioral tests covering value propagation, text
  replacements, combo refresh, widget cleanup, connection
  validation, and primitive node auto-creation
2026-05-13 13:43:57 -07:00

File diff suppressed because it is too large Load Diff