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

Converts tests for FormTokenField to use React.TestUtils #7777

Merged

Conversation

nerrad
Copy link
Contributor

@nerrad nerrad commented Jul 8, 2018

Description

This converts the tests for components/form-token-field/test/index.js from enzyme to React.TestUtils. This is because enzyme does not support React 16.3+ (and movement to do so is really slow). This will fix issues with breakage due to the enzyme incompatibility as components receive React 16.3+ features (such as forwardRef usage in #7557)

Since this test is simulating events on rendered elements into a DOM, this required the use of React.TestUtils over react-test-renderer.

The neat thing here is this also shaved close to a second off of the execution time for this test (Note: very rudimentary comparison of the average between 3 runs without these changes and 3 runs after these changes)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Since this test is simulating events on rendered elements into a DOM, this required the use of React.TestUtils over react-test-renderer.

The neat thing here is this also shaved close to a second off of the execution time for this test.
@nerrad nerrad self-assigned this Jul 8, 2018
@nerrad nerrad added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Jul 8, 2018
Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Nice 👍

@aduth aduth merged commit 71de6e5 into master Jul 12, 2018
@aduth aduth deleted the update/convert-enzyme-tests-to-use-test-utils-form-token-field.js branch July 12, 2018 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants