-
Notifications
You must be signed in to change notification settings - Fork 274
refactor(breaking): rename container
to UNSAFE_root
; introduce root
host element
#1298
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
Conversation
container
APIcontainer
to UNSAFE_root
; introduce root
host element
@@ -16,6 +16,12 @@ const defaultScreen: RenderResult = { | |||
get container(): ReactTestInstance { | |||
throw new Error(SCREEN_ERROR); | |||
}, | |||
get root(): ReactTestInstance { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type accurate? Isn't there a narrower type for host elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately no, though we might think about something like that in the future
205d266
to
f842f8b
Compare
A reference to the rendered root element. | ||
Returns the rendered root [host element](testing-env#host-and-composite-components). | ||
|
||
This API is primarily useful in component tests, as it allows you to access root host view without using `*ByTestId` queries or similar methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it could be interesting to give more indications on what we think are good use cases for this api (e.g. asserting an element is not rendered) because I don't think it's very intuitive how to use this
Co-authored-by: Pierre Zimmermann <[email protected]>
9e5a590
to
8597706
Compare
Codecov ReportBase: 96.07% // Head: 96.09% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1298 +/- ##
==========================================
+ Coverage 96.07% 96.09% +0.02%
==========================================
Files 49 49
Lines 3308 3333 +25
Branches 497 503 +6
==========================================
+ Hits 3178 3203 +25
Misses 130 130
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Summary
This PR contains breaking changes behind
useBreakingChanges
feature flag.Resolves #1296
container
toUNSAFE_root
container
(behinduseBreakingChanges
)root
API that returns root host element.Test plan
All tests pass.