Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: check if in browser env before calling CSS.supports #34572

Merged
merged 2 commits into from
Sep 6, 2021

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Sep 6, 2021

Description

Fixes #34476

Add additional check to make sure that CSS.supports is only run when in a browser environment.

This was previously causing errors when running unit tests in a node environment.

How has this been tested?

Test pass

Screenshots

N/A

Types of changes

Bug fix (prevents unit tests errors)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • N/A I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@ciampo ciampo added [Type] Bug An existing feature does not function as intended [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Components /packages/components [Feature] Component System WordPress component system labels Sep 6, 2021
@ciampo ciampo self-assigned this Sep 6, 2021
@ciampo ciampo added this to In progress (owned) ⏳ in WordPress Components via automation Sep 6, 2021
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, thank you for the fix 👍🏻

@ciampo
Copy link
Contributor Author

ciampo commented Sep 6, 2021

There seem to be some unrelated CI issues on a few checks — will merge this PR once those are fixed.

@ciampo ciampo merged commit a2e180a into trunk Sep 6, 2021
WordPress Components automation moved this from In progress (owned) ⏳ to Done 🎉 Sep 6, 2021
@ciampo ciampo deleted the fix/components-utils-css-supports-check branch September 6, 2021 14:14
@github-actions github-actions bot added this to the Gutenberg 11.5 milestone Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Component System WordPress component system [Package] Components /packages/components [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Bug An existing feature does not function as intended
Projects
Development

Successfully merging this pull request may close these issues.

"ReferenceError: CSS is not defined" when testing with wp-scripts test-unit-js
2 participants