Skip to content

test(web-shared): add CopyableDataBlock tests on top of #2434#2584

Merged
mitul-s merged 1 commit into
c-ms/35da3c9ffrom
c+ms/copyable-data-block-tests-on-2434-0803
Jun 23, 2026
Merged

test(web-shared): add CopyableDataBlock tests on top of #2434#2584
mitul-s merged 1 commit into
c-ms/35da3c9ffrom
c+ms/copyable-data-block-tests-on-2434-0803

Conversation

@mitul-s

@mitul-s mitul-s commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacks the CopyableDataBlock / EncryptedDataBlock unit tests on top of #2434 (fix(web-shared): stop data inspector duplicating expanded objects) and verifies they pass against that PR's rewritten data-inspector.tsx.

This PR targets #2434's branch (c-ms/35da3c9f), so its diff is just the added tests plus the small serializeForClipboard export. If #2434's rendering/data-inspector changes ever break the copyable data block, these tests are the guard.

Changes

  • packages/web-shared/src/components/sidebar/copyable-data-block.tsx: export serializeForClipboard (no behavior change).
  • packages/web-shared/test/copyable-data-block.test.ts: new test file (12 tests).
  • .changeset/copyable-data-block-tests.md: patch changeset.

Coverage

serializeForClipboard: strings verbatim, primitives stringified, objects/arrays pretty-printed as 2-space JSON, String() fallback for circular refs and BigInt, undefined passthrough.

Rendering (via react-dom/server, matching the package's existing no-jsdom style): CopyableDataBlock copy button + no-throw across payloads; EncryptedDataBlock Encrypted badge / enabled / disabled Decrypt states.

Verification (against #2434's code)

  • pnpm vitest run test/copyable-data-block.test.ts → 12/12 pass
  • pnpm typecheck → clean (tests compile against the rewritten DataInspector exports)

Note

This is the same test suite as #2583 (which is based on main); this PR rebases it onto #2434 to validate the data-inspector rewrite. If #2434 merges first, #2583 can be closed (or vice versa) to avoid a duplicate changeset.

Open in Web Open in Cursor 

Export serializeForClipboard and cover its clipboard formatting (strings, primitives, pretty-printed JSON, circular/BigInt fallbacks) plus CopyableDataBlock/EncryptedDataBlock rendering.
@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8f2c6af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@workflow/web-shared Patch
@workflow/web Patch
@workflow/cli Patch
@workflow/nitro Patch
workflow Patch
@workflow/world-testing Patch
@workflow/nuxt Patch
@workflow/core Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/vitest Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jun 23, 2026 4:15pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jun 23, 2026 4:15pm
example-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-astro-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-express-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-fastify-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-hono-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-nitro-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workbench-vite-workflow Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Jun 23, 2026 4:15pm
workflow-swc-playground Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workflow-tarballs Ready Ready Preview, Comment Jun 23, 2026 4:15pm
workflow-web Ready Ready Preview, Comment Jun 23, 2026 4:15pm

@mitul-s mitul-s marked this pull request as ready for review June 23, 2026 18:07
@mitul-s mitul-s requested a review from a team as a code owner June 23, 2026 18:07
@mitul-s mitul-s merged commit 3683398 into c-ms/35da3c9f Jun 23, 2026
48 checks passed
@mitul-s mitul-s deleted the c+ms/copyable-data-block-tests-on-2434-0803 branch June 23, 2026 18:07
mitul-s added a commit that referenced this pull request Jun 23, 2026
…vigation) (#2434)

* fix(web-shared): stop data inspector duplicating expanded objects

Expanded objects/arrays now render bracket delimiters ({ … } / [ … ])
instead of repeating the inline preview alongside the child tree.

Co-authored-by: Cursor <cursoragent@cursor.com>

* nice

* fix: sync lockfile after dropping react-inspector

The react-inspector removal landed in package.json but the lockfile was
reverted during cleanup, breaking frozen-lockfile installs in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): keep data inspector colors theme-aware

Drop the dark-mode color overrides (and the data-theme/useDarkMode
wiring) and rely on the theme-aware --ds-* tokens, matching front:
strings stay green in both light and dark instead of turning blue.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add data inspector tests; tidy comments

Cover collapseRefs ref/typed-array/Map/Set handling and the rendered
tree (keys, value colors, brackets, commas, collapse/expand, empties,
dates, class/Map/Set prefixes) via jsdom + testing-library.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert(web-shared): drop data inspector tests

Remove the test suite and its jsdom/@testing-library devDependencies to
avoid adding new packages. Keeps the data inspector code unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(web-shared): extract data inspector styles to a sibling module

Move the class-name map and CSS string out of the component into
data-inspector.styles.ts for readability. Still injected via the
hoistable <style>; no behavior or dependency change.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): restore ARIA tree semantics for the data inspector

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): render RegExp values as /source/flags

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add unit tests for CopyableDataBlock JSON viewer (#2584)

Export serializeForClipboard and cover its clipboard formatting (strings, primitives, pretty-printed JSON, circular/BigInt fallbacks) plus CopyableDataBlock/EncryptedDataBlock rendering.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
github-actions Bot added a commit that referenced this pull request Jun 23, 2026
…vigation) (#2434)

* fix(web-shared): stop data inspector duplicating expanded objects

Expanded objects/arrays now render bracket delimiters ({ … } / [ … ])
instead of repeating the inline preview alongside the child tree.

Co-authored-by: Cursor <cursoragent@cursor.com>

* nice

* fix: sync lockfile after dropping react-inspector

The react-inspector removal landed in package.json but the lockfile was
reverted during cleanup, breaking frozen-lockfile installs in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): keep data inspector colors theme-aware

Drop the dark-mode color overrides (and the data-theme/useDarkMode
wiring) and rely on the theme-aware --ds-* tokens, matching front:
strings stay green in both light and dark instead of turning blue.

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add data inspector tests; tidy comments

Cover collapseRefs ref/typed-array/Map/Set handling and the rendered
tree (keys, value colors, brackets, commas, collapse/expand, empties,
dates, class/Map/Set prefixes) via jsdom + testing-library.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert(web-shared): drop data inspector tests

Remove the test suite and its jsdom/@testing-library devDependencies to
avoid adding new packages. Keeps the data inspector code unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor(web-shared): extract data inspector styles to a sibling module

Move the class-name map and CSS string out of the component into
data-inspector.styles.ts for readability. Still injected via the
hoistable <style>; no behavior or dependency change.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): restore ARIA tree semantics for the data inspector

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(web-shared): render RegExp values as /source/flags

Co-authored-by: Cursor <cursoragent@cursor.com>

* test(web-shared): add unit tests for CopyableDataBlock JSON viewer (#2584)

Export serializeForClipboard and cover its clipboard formatting (strings, primitives, pretty-printed JSON, circular/BigInt fallbacks) plus CopyableDataBlock/EncryptedDataBlock rendering.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants