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

feat: allow checking only host elements or composite Text/TextInput (BREAKING) #143

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mdjastrzebski
Copy link
Collaborator

@mdjastrzebski mdjastrzebski commented Jan 10, 2023

What:

Throw error when running Jest Native matchers on non-host elements. Most of the RNTL queries already return host elements. For compatibility reason also allow passing composite Text and TextInput elements, as some RNTL still return these two composite elements (getByText, getByPlaceholderText, and getByDisplayValue).

Why:

According to our own docs:

Keep in mind that these queries are intended only to work with elements corresponding to host components.
Source: https://github.com/testing-library/jest-native#matchers

How:

Modify checkReactElement to allow only host elements and composite Text and TextInput

Checklist:

  • Documentation added to the docs
  • Typescript definitions updated
  • Tests
  • Ready to be merged

@codecov
Copy link

codecov bot commented Jan 10, 2023

Codecov Report

Merging #143 (571f3dc) into main (e815954) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #143   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          252       251    -1     
  Branches        76        76           
=========================================
- Hits           252       251    -1     
Flag Coverage Δ
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)
node-18 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/utils.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant