Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/testing-library__dom

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/testing-library__dom

TypeScript definitions for @testing-library/dom

  • 6.5.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/testing-library__dom?

@types/testing-library__dom provides TypeScript definitions for the DOM Testing Library, which is a part of the Testing Library family. It helps in writing tests that interact with the DOM in a way that resembles how a user would interact with it.

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

Querying Elements

This feature allows you to query DOM elements by their text content. The code sample demonstrates how to use the `getByText` function to find an element with the text 'Hello World'.

const { getByText } = require('@testing-library/dom');
const element = getByText(document.body, 'Hello World');

Event Simulation

This feature allows you to simulate user events such as clicks, typing, etc. The code sample shows how to simulate a click event on a button element.

const { fireEvent } = require('@testing-library/dom');
const button = document.querySelector('button');
fireEvent.click(button);

Assertions

This feature allows you to make assertions about the state of the DOM. The code sample demonstrates how to assert that an element with the text 'Hello World' is present in the document.

const { getByText } = require('@testing-library/dom');
const element = getByText(document.body, 'Hello World');
expect(element).toBeInTheDocument();

Other packages similar to @types/testing-library__dom

FAQs

Package last updated on 14 Oct 2019

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