Conversation
diegohaz
commented
Feb 25, 2020
Comment on lines
+4
to
+13
| <div> | ||
| <div | ||
| data-position="first" | ||
| />, | ||
| /> | ||
| <div | ||
| data-position="second" | ||
| > | ||
| Content | ||
| </div>, | ||
| ] | ||
| </div> | ||
| </div> |
Member
Author
There was a problem hiding this comment.
All the snapshots will have this wrapping div added by react-testing-library.
diegohaz
commented
Feb 25, 2020
Comment on lines
29
to
44
| exports[`Slot bubblesVirtually true should subsume another slot by the same name 1`] = ` | ||
| Array [ | ||
| <div> | ||
| <div | ||
| data-position="first" | ||
| > | ||
| <div /> | ||
| </div>, | ||
| </div> | ||
| <div | ||
| data-position="second" | ||
| > | ||
| <div /> | ||
| </div>, | ||
| ] | ||
| <div> | ||
| Content | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; |
|
Size Change: 0 B Total Size: 889 kB ℹ️ View Unchanged
|
This was referenced Feb 25, 2020
|
This is awesome!! Making Portals work seamlessly with testing is a big win. Not only that, but it looks like we're making tests easier to write as well with |
gziolo
approved these changes
Apr 6, 2020
Member
gziolo
left a comment
There was a problem hiding this comment.
Let's give it a try. It needs to be rebased :)
Member
|
One more thing, if this turns out to be useful, we should add RTL as a dependency for |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a simpler alternative to #18855, and, to some extent, addresses #17249.
Comparing to #18855, we lose some features like simulating real user interactions.
@testing-library/reactprovides afireEventutil, whose implementation is pretty much like this:So, calling
fireEvent.clickwill only dispatch theclickevent, not the whole event stack dispatched by browsers when users perform a click action, such asmouseDown,mouseUpetc.On the other hand, this PR is much smaller, and we don't have to maintain a new package as in #18855. If we do need those test utilities, the PR is there and we can merge it in the future. But just adding
@testing-library/reacthere is already a big improvement over the current unit testing approaches we have in this project. Namely,react-dom/test-utils,react-test-rendererandenzyme, as demonstrated in #17249 (comment).As an implementation example, this PR improves the SlotFill tests that weren't covering the
bubblesVirtuallycase (react-test-rendererdoesn't support portals). This issue was mentioned on #19242 (comment).How has this been tested?
npm run test-unitScreenshots
Types of changes
New feature
Checklist: