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

feature: implement toBeVisible Jest matcher #1458

Closed
mdjastrzebski opened this issue Aug 17, 2023 · 4 comments
Closed

feature: implement toBeVisible Jest matcher #1458

mdjastrzebski opened this issue Aug 17, 2023 · 4 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mdjastrzebski
Copy link
Member

mdjastrzebski commented Aug 17, 2023

Describe the Feature

toBeVisible is a Jest DOM matcher that asserts the visibility of given element by inspecting various CSS styles and other semantic attributes that might make element invisible.

Adapting it to our case it would assert the value in TextInput host elements, to match given value.

Possible Implementations

Proposed API:

export function toBeVisible(
  this: jest.MatcherContext,
  element: ReactTestInstance
)

The matcher should:

  1. Validate that it is invoked on host element
  2. Check visibility status of given element and all of it's ancestors

Each matcher should have a fairly comprehensive test suite.

Open Questions:

  • should this matcher take into account accessibility props? Consider use cases and pros and cons,

Links

Related Issues

#1454

@mdjastrzebski mdjastrzebski added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 17, 2023
@thiagobrez
Copy link
Contributor

Hey, would love to give a try at this one!

@mdjastrzebski
Copy link
Member Author

@thiagobrez go ahead! Simply submit PR with your work in progress.

@thiagobrez
Copy link
Contributor

PR is ready to review here: #1465

@mdjastrzebski
Copy link
Member Author

🎉 Release in version: v12.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants