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

fix(datepicker): added waitFor() to react.lazy test #15702

Conversation

jt-helsinki
Copy link
Contributor

@jt-helsinki jt-helsinki commented Feb 6, 2024

Closes #15701

{{short description}}

Changelog

New

  • {{new thing}}

Changed

  • {{change thing}}

Removed

  • {{removed thing}}

Testing / Reviewing

{{ Add descriptions, steps or a checklist for how reviewers can verify this PR works or not }}

@jt-helsinki jt-helsinki requested a review from a team as a code owner February 6, 2024 13:42
@jt-helsinki
Copy link
Contributor Author

fixes: #15701

Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7fc9156
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/65c2373e8bd1850008f8117e
😎 Deploy Preview https://deploy-preview-15702--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f3f3ace
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/65c2466ace2cc20008947efe
😎 Deploy Preview https://deploy-preview-15702--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tay1orjones
Copy link
Member

Hey thanks for opening this, could you outline how this helps the test? The RTL docs state that findBy* queries are a combination of getBy queries and waitFor, the waitFor options are the last argument.

I think this change will cause a warning to pop during the the lint ci check - eslint-plugin-testing-library is configured to be ran on these files:

extends: ['plugin:testing-library/react'],
files: ['packages/react/**/*-test.js'],
rules: {
'testing-library/no-node-access': [
'error',
{ allowContainerFirstChild: true },
],
},

This preset enables the prefer-find-by rule, which typically warns on usages like this.

@jt-helsinki
Copy link
Contributor Author

@tay1orjones

Yes, you're right. What I added wasn't quite right. I've updated this to add the timeout directly to the call to findByLabelText().

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@carbon-bot carbon-bot added this pull request to the merge queue Feb 6, 2024
Merged via the queue into carbon-design-system:main with commit 7719b73 Feb 6, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: DatrePicker-test.js react.lazy test should use waitFor()
4 participants