Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update intro.mdx import #1446

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

Open
minsoo-web wants to merge 1 commit into testing-library:main
base: main
Choose a base branch
Loading
from minsoo-web:patch-1

Conversation

Copy link

@minsoo-web minsoo-web commented Nov 4, 2024

This page is based on v14, so I think it should use named import.

Copy link

netlify bot commented Nov 4, 2024
edited
Loading

Deploy Preview for testing-library ready!

Name Link
🔨 Latest commit 2820068
🔍 Latest deploy log https://app.netlify.com/sites/testing-library/deploys/67286d094c713e000891ee37
😎 Deploy Preview https://deploy-preview-1446--testing-library.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
Member

@ph-fritsche Any chance to get your look at this one? I remember we had some issues with that named import?

Copy link

Might be worth using this PR to update a few other places referencing v14 - https://github.com/testing-library/testing-library-docs/pull/1476/files has some examples!

Copy link
Member

I'm not sure...

  • Direct APIs will be deprecated and removed at some point.
  • Preparing the document is necessary and giving users the option to call this (and cleanup callbacks) at any point might solve compatibility issues with other frameworks/tools. feat: export callbacks for hooks user-event#1270
  • A test that reuses old pointer/keyboard state might be confusing. Therefore we should keep on recommending to call setup() inside the test. Using a setup function that combines this with render function of the respecting framework gives a clean and concise test code.
// current recommendation according to docs
import userEvent, {PointerEventsCheckLevel} from '@testing-library/user-event'
const user = userEvent.setup()
await user.setup({pointerEventsCheck: PointerEventsCheckLevel.Never}).click()
// also possible, but not officially recommended
import { userEvent, PointerEventsCheckLevel} from '@testing-library/user-event'

If we expose prepare, reset and detach with the next version, we could also expose setup as named export.

import {setup, PointerEventsCheckLevel} from '@testing-library/user-event'
// or if the user prefers
import * as userEvent from '@testing-library/user-event'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /