Socket
Socket
Sign inDemoInstall

@types/testing-library__jest-dom

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/testing-library__jest-dom

TypeScript definitions for @testing-library/jest-dom


Version published
Weekly downloads
5.2M
increased by7.04%
Maintainers
1
Weekly downloads
 
Created

What is @types/testing-library__jest-dom?

The @types/testing-library__jest-dom package provides TypeScript type definitions for the jest-dom library, which extends Jest's default matchers to provide more expressive assertions for DOM nodes. This allows developers to write more readable and maintainable tests when using Jest with the DOM or React components.

What are @types/testing-library__jest-dom's main functionalities?

toBeVisible

Checks if an element is visible to the user. This means that the element is not only displayed (i.e., it does not have a CSS display value of 'none'), but also has a non-zero size and is not hidden by other elements.

expect(element).toBeVisible();

toHaveTextContent

Asserts that a given DOM element has text content that matches the expected text, which can be a string or a regular expression.

expect(element).toHaveTextContent('text');

toHaveAttribute

Ensures that a DOM element has an attribute with a specific value. This is useful for checking if elements have the correct attributes set, such as links with the correct href values.

expect(element).toHaveAttribute('href', 'https://example.com');

toHaveClass

Verifies that a DOM element has a particular class or classes. This matcher can take a single class name as a string, or an array of class names to check for multiple classes.

expect(element).toHaveClass('class-name');

toBeChecked

Asserts that an input element of type checkbox or radio is checked. This is useful for ensuring that form elements are in the expected state in response to user interactions or initial conditions.

expect(checkbox).toBeChecked();

Other packages similar to @types/testing-library__jest-dom

FAQs

Package last updated on 23 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc