Skip to content

[Refactor] Reuse webview render helper in chat and settings specs - #1203

Merged
edelauna merged 1 commit into
mainfrom
feature/webview-render-helper-2-26vxix3b5tqmz
Aug 9, 2026
Merged

[Refactor] Reuse webview render helper in chat and settings specs#1203
edelauna merged 1 commit into
mainfrom
feature/webview-render-helper-2-26vxix3b5tqmz

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

N/A: Phase 3 webview test-utils refactor batch.

Description

Extends the ChatRow batch in #1196 across the remaining mechanically similar chat and settings specs. Twelve specs now render through the shared renderWithExtensionState helper instead of assembling QueryClientProvider / ExtensionStateContextProvider wrappers by hand:

  • Chat: ChatView.preserve-images, ChatView.notification-sound, ChatView.scroll-debug-repro, ChatView.clear-approval-buttons, ChatView.keyboard-fix, TaskHeader
  • Settings: RulesSettings, SkillsSettings, SlashCommandsSettings, ApiOptions, ApiOptions.provider-filtering, SettingsView

Notes for reviewers:

  • The RulesSettings / SkillsSettings / SlashCommandsSettings specs keep their local @/context/ExtensionStateContext mock (passthrough provider + mutable scenario state set per render); only the QueryClient boilerplate was removed.
  • TaskHeader and ApiOptions.provider-filtering mocked only useExtensionState, so their local vi.mock gained a one-line passthrough ExtensionStateContextProvider — required for the shared helper's provider import to resolve.
  • SettingsView rerenders now pass only the inner element; RTL reuses the helper's wrapper.
  • Remaining manual QueryClient boilerplate lives in SettingsView.change-detection, SettingsView.unsaved-changes, and the two ModelPicker specs, which reuse the client for rerenders/cache access — those land in a follow-up batch to close the lane.

Component mocks, fixtures, and assertions stay local and unchanged. This is a test-only refactor with no intended runtime or user-facing behavior change.

Test Procedure

  • pnpm exec vitest run over the 12 touched specs from webview-ui (145 tests passed)
  • pnpm test (445 files passed, 4 skipped; 7,355 tests passed, 39 skipped)
  • pnpm lint
  • pnpm check-types

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): Not applicable; this is a test-only refactor with no rendered UI change.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

Not applicable; no product UI changed.

Videos (interaction / animation only)

Not applicable; no product interaction changed.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Additional Notes

No changesets were added. Author self-review found no behavior or scope regressions.

Get in Touch

Mention @roomote on this PR for follow-up requests.

Co-authored-by: Roomote <roomote@roomote.dev>
@zoomote

zoomote Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Author self-review summary:

  • Scope: 12 specs, 38 insertions / 174 deletions. Helper adoption only — component mocks, fixtures, and assertions unchanged.
  • All renders in these files now go through renderWithExtensionState; no QueryClient/QueryClientProvider/ExtensionStateContextProvider boilerplate remains except the intentional passthrough mocks in TaskHeader and ApiOptions.provider-filtering (required so the helper's provider import resolves against their useExtensionState-only mocks).
  • One nuance worth knowing: in those two files, state flows through the mocked useExtensionState, so the helper's state option would be a no-op there — consistent with their existing scenario style.
  • Lane status: SettingsView.change-detection, SettingsView.unsaved-changes, and the two ModelPicker specs still carry manual QueryClient boilerplate (rerender/cache access) — follow-up batch closes the lane.
  • Validation: 145/145 focused tests; full pnpm test (445 files, 7,355 tests passed); pnpm lint; pnpm check-types.
  • No production code, docs, or changesets touched. Visual proof not applicable (test-only refactor).

Per initiative policy, not approving this Roomote-authored PR — leaving review to a human maintainer.

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna enabled auto-merge August 9, 2026 00:41
@edelauna
edelauna added this pull request to the merge queue Aug 9, 2026
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 9, 2026
Merged via the queue into main with commit 02f7902 Aug 9, 2026
26 checks passed
@edelauna
edelauna deleted the feature/webview-render-helper-2-26vxix3b5tqmz branch August 9, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants