Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

fix(react): fix jsdom react testing issues #6612

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

ashleyryan
Copy link

@ashleyryan ashleyryan commented Jan 31, 2022

Fixes #5985

  • Add isNode check to property syncing in cdscontrol to prevent error

Fixes #6525:

Signed-off-by: Ashley Ryan asryan@vmware.com

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • If applicable, have a visual design approval

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • clarity.design website / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue #5985
When rendering CdsSelect in jsdom (via react-testing-library), an exception will be thrown on render and all tests will fail.

Issue #6525
The aria-reflect polyfill doesn't run in node because of jsdom exceptions, meaning react unit tests can't target elements by role

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@ashleyryan
Copy link
Author

I repurposed the repo-clarity-proxy-set-disabled repo to test the fixes using RTL and they work now with yalc: https://github.com/ashleyryan/repro-clarity-proxy-set-disabled/blob/main/test.test.tsx

packages/core/docs/react.stories.mdx Show resolved Hide resolved
packages/core/src/internal/utils/environment.ts Outdated Show resolved Hide resolved
packages/core/src/internal/utils/events.ts Outdated Show resolved Hide resolved
Fixes vmware#5985
- Add isNode check to property syncing in cdscontrol.

Fixes vmware#6525:
- Remove isNode check for aria-reflect, now that all roles are set in connectedCallback

Signed-off-by: Ashley Ryan <asryan@vmware.com>
@ashleyryan ashleyryan merged commit 52fb904 into vmware-archive:next Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants