-
Notifications
You must be signed in to change notification settings - Fork 273
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
API proposal: Jest Native matchers migration #1468
Comments
Fully agree with all of the above! I'll try to take one or two tasks when i come back from vacation in a week or so. |
That seems perfect! Great work @mdjastrzebski ! |
Update: Jest Native package includes legacy extend as of 5.4.3 🚀🎉 This is not yet publicly documented, that will be done after we complete RNTL matcher migration. In order to use legacy extend
In the default setup nothing changes, so you need the changed import to enable |
Hello ! |
Summary: Note: this PR is related only to testing mocks provided by RN, and does not affect runtime code. When building new Jest matchers for React Native Testing Library (callstack/react-native-testing-library#1468) I've noticed that when rendering React Native in Jest using React Test Renderer the mocked `Modal` component renders host `Modal` element when `visible={false}`. This seems to be incorrect as only visible modal should render any host elements. Not visible one should not render any host element even empty ones. Current mock implementation also contradicts the behaviour of non-mocked `Modal` which does not render `RCTModalHostView` in such case. ## Changelog: [General] [Fixed] - Do not render mocked <Modal /> when `visible=false` Pull Request resolved: #39157 Test Plan: I've added test showing that non-mocked Modal renders to `null` and modifies the existing tests so that mocked Modal also renders to `null.` Luna: I've updated relevant snapshots Reviewed By: NickGerleman Differential Revision: D48728277 Pulled By: lunaleaps fbshipit-source-id: cf06495ad959e2d9549241b57f46f75d7beb9eae
Hi everyone, Here is a PR for the |
Hello ! Here is one for the |
Hi, is anyone currently working on |
@siepra go ahead, it's yours now. |
Here is also a PR for the |
🎉 Available in version: v12.4.0 |
API proposal for Jest matchers migration
This issue describes the desired API regarding Jest matchers to be included in RNTL package, and that should replace the Jest Native package matchers.
Problems with the current Jest Native matchers:
The goals of this initiative are as follows:
Matchers to keep
toBeOnTheScreen
- feature: Jest matchers core #1454toBeVisible
- feat:toBeVisible
matcher #1465toBeEmptyElement
- feat:toBeEmptyElement
matcher #1462toBeDisabled
+ *toBeEnabled
- feat:toBeDisabled
matcher #1469toContainElement
feat:toContainElement
matcher #1495toHaveProp
feat:toHaveProp
matcher #1477toHaveStyle
feat:toHaveStyle
matcher #1487toHaveAccessibleValue
Implement toHaveAccessibilityValue matcher #1496 (renamed fromtoHaveAccessibilityValue
to match Jest DOM convention)Matchers to change signature
toHaveTextContent
- feat:toHaveTextContent()
matcher #1461TextMatcherOptions
as options (in line with most queries),Matchers to add
toHaveDisplayValue
- feat:toHaveDisplayValue
matcher #1463, based on Jest DOM matchertoBeChecked
/toBePartiallyChecked
based on Jest DOM matcher feat:toBeChecked
&toBePartiallyChecked
matcher #1479toBeSelected
feat: implementtoBeSelected
matcher #1488 - replacingtoHaveAccessibilityState
, elements withacccessibiltyState: { selected }
toBeBusy
feat:toBeBusy()
matcher #1493 - replacingtoHaveAccessibilityState
, elements withacccessibiltyState: { busy }
toBeExpanded
feat:toBeExpanded
matcher #1497 - replacingtoHaveAccessibilityState
, elements withacccessibiltyState: { expanded }
toHaveAccessibleName
based on Jest DOM matcher, elements with text content oraccessibilityLabel
propMatchers to remove
toHaveAccessibilityState
- to be replaced bytoBeDisabled
,toBe(Partially)Checked
, etcMigration path
legacy
prefix, so that users will avoid name clashes onexpect
function. This will be provided by Jest Native and not the RNTL in order to avoid having to managed that code inside RNTL and to keep it in the final state for potentially long time.The text was updated successfully, but these errors were encountered: