test(web-shared): add CopyableDataBlock tests on top of #2434#2584
Merged
mitul-s merged 1 commit intoJun 23, 2026
Conversation
Export serializeForClipboard and cover its clipboard formatting (strings, primitives, pretty-printed JSON, circular/BigInt fallbacks) plus CopyableDataBlock/EncryptedDataBlock rendering.
🦋 Changeset detectedLatest commit: 8f2c6af The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
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 |
Contributor
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacks the
CopyableDataBlock/EncryptedDataBlockunit tests on top of #2434 (fix(web-shared): stop data inspector duplicating expanded objects) and verifies they pass against that PR's rewrittendata-inspector.tsx.This PR targets #2434's branch (
c-ms/35da3c9f), so its diff is just the added tests plus the smallserializeForClipboardexport. 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: exportserializeForClipboard(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 andBigInt,undefinedpassthrough.Rendering (via
react-dom/server, matching the package's existing no-jsdom style):CopyableDataBlockcopy button + no-throw across payloads;EncryptedDataBlockEncrypted badge / enabled / disabled Decrypt states.Verification (against #2434's code)
pnpm vitest run test/copyable-data-block.test.ts→ 12/12 passpnpm typecheck→ clean (tests compile against the rewrittenDataInspectorexports)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.