Skip to content

Add dedicated unit tests for BlockRow.svelte #295

Description

@brylie

#239 extracted src/lib/components/BlockRow.svelte as a new, independently reusable component — the shared move handle, block action menu, multi-select/just-navigated highlighting, to_do/bulleted/numbered/toggle gutter, and divider/quote/freeform-text content dispatch, consumed by both +page.svelte's top-level block loop and ColumnsBlock.svelte's per-column loop.

Every other reusable component under src/lib/components/ has its own dedicated *.svelte.test.ts (BlockActionMenu, BlockEditor, CalloutBlock, ChildPagesBlock, CollectionViewBlock, ColumnsBlock, SyncedBlockUsage, and more) — BlockRow.svelte does not. Its behavior today is exercised only indirectly, through ColumnsBlock.svelte.test.ts and page.svelte.test.ts.

A regression introduced directly inside BlockRow.svelte — in the customContent/customBlockTypes extension-point gating, the heldByActorLabel placeholder, the numberedListIndex computation, or an optional prop like onToggleCollapse/onLinkShortcut/onArrowUpAtStart/onArrowDownAtEnd — would only surface as a confusing failure in one of those two callers' suites rather than pointing at BlockRow directly. #227 (toggle blocks becoming real containers) is already expected to become a third consumer of BlockRow, and will have nothing but those two indirect suites to build confidence on its own contract.

  • src/lib/components/BlockRow.svelte.test.ts renders BlockRow directly (not through a caller) and covers: the move handle + block action menu wiring, selection/just-navigated highlight classes, the to_do/bulleted_list_item/numbered_list_item/toggle gutter (onToggleCollapse both provided and omitted), the divider/quote/default-text content dispatch, the heldByActorLabel placeholder, and the customContent/customBlockTypes/trailingContent/insideContent extension points both present and absent.

Done when: BlockRow.svelte.test.ts exists and passes, exercising BlockRow in isolation across the cases above, independent of ColumnsBlock.svelte.test.ts and page.svelte.test.ts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions