@testing-library/dom
Simple and complete DOM testing utilities that encourage good testing practices.
Last updated 4 years ago by testing-library-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @testing-library/dom 
SYNC missed versions from official npm registry.

DOM Testing Library

octopus

Simple and complete DOM testing utilities that encourage good testing practices.

Read the docs | Edit the docs


[![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] ![All Contributors][all-contributors-badge] [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] [![Discord][discord-badge]][discord]

[![Watch on GitHub][github-watch-badge]][github-watch] [![Star on GitHub][github-star-badge]][github-star] [![Tweet][twitter-badge]][twitter]

TestingJavaScript.com Learn the smart, efficient way to test any JavaScript application.

Table of Contents

The Problem

You want to write maintainable tests for your Web UI. As a part of this goal, you want your tests to avoid including implementation details of your components and rather focus on making your tests give you the confidence for which they are intended. As part of this, you want your testbase to be maintainable in the long run so refactors of your components (changes to implementation but not functionality) don't break your tests and slow you and your team down.

This Solution

The DOM Testing Library is a very light-weight solution for testing DOM nodes (whether simulated with JSDOM as provided by default with [Jest][] or in the browser). The main utilities it provides involve querying the DOM for nodes in a way that's similar to how the user finds elements on the page. In this way, the library helps ensure your tests give you confidence in your UI code. The DOM Testing Library's primary guiding principle is:

[The more your tests resemble the way your software is used, the more confidence they can give you.][guiding-principle]

Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's devDependencies:

npm install --save-dev @testing-library/dom

Docs

Documentation

Read the docs (and discover framework and tool-specific implementations) at testing-library.com

Guiding Principles

[The more your tests resemble the way your software is used, the more confidence they can give you.][guiding-principle]

We try to only expose methods and utilities that encourage you to write tests that closely resemble how your web pages are used.

Utilities are included in this project based on the following guiding principles:

  1. If it relates to rendering components, it deals with DOM nodes rather than component instances, nor should it encourage dealing with component instances.
  2. It should be generally useful for testing the application components in the way the user would use it. We are making some trade-offs here because we're using a computer and often a simulated browser environment, but in general, utilities should encourage tests that use the components the way they're intended to be used.
  3. Utility implementations and APIs should be simple and flexible.

At the end of the day, what we want is for this library to be pretty light-weight, simple, and understandable.

Contributors

Thanks goes to these people ([emoji key][emojis]):

Kent C. Dodds
Kent C. Dodds

💻 📖 🚇 ⚠️
Greg Bergé
Greg Bergé

🤔
Ryan Castner
Ryan Castner

📖
Daniel Sandiego
Daniel Sandiego

💻
Paweł Mikołajczyk
Paweł Mikołajczyk

💻
Alejandro Ñáñez Ortiz
Alejandro Ñáñez Ortiz

📖
Matt Parrish
Matt Parrish

🐛 💻 📖 ⚠️
Justin Hall
Justin Hall

📦
Anto Aravinth
Anto Aravinth

💻 ⚠️ 📖
Jonah Moses
Jonah Moses

📖
Łukasz Gandecki
Łukasz Gandecki

💻 ⚠️ 📖
Ivan Babak
Ivan Babak

🐛 🤔 💻 📖
Jesse Day
Jesse Day

💻
Ernesto García
Ernesto García

💬 💻 📖
Josef Maxx Blake
Josef Maxx Blake

💻 📖 ⚠️
Alex Cook
Alex Cook

📖 💡 👀
Daniel Cook
Daniel Cook

💻 📖 ⚠️
Thomas Chia
Thomas Chia

🐛 💻
Tim Deschryver
Tim Deschryver

💻 ⚠️ 👀
Alex Krolick
Alex Krolick

💻
Maddi Joyce
Maddi Joyce

💻
Peter Kamps
Peter Kamps

🐛 💻 ⚠️
Jonathan Stoye
Jonathan Stoye

📖 💻
Sanghyeon Lee
Sanghyeon Lee

💡
Justice Mba
Justice Mba

💻 📖 🤔
Wayne Crouch
Wayne Crouch

💻
Ben Elliott
Ben Elliott

💻
Ruben Costa
Ruben Costa

💻
Robert Smith
Robert Smith

🐛 🤔 📖
dadamssg
dadamssg

💻
Neil Kistner
Neil Kistner

💻 ⚠️
Ben Chauvette
Ben Chauvette

💻
Jeff Baumgardt
Jeff Baumgardt

💻 📖
Matan Kushner
Matan Kushner

💻 📖 🤔 ⚠️
Alex Wendte
Alex Wendte

💻 📖 ⚠️
Tamas Fodor
Tamas Fodor

📖
Benjamin Eckardt
Benjamin Eckardt

💻
Ryan Campbell
Ryan Campbell

📖
Taylor Briggs
Taylor Briggs

⚠️
John Gozde
John Gozde

💻
C. T. Lin
C. T. Lin

📖
Terrence Wong
Terrence Wong

💻
Soo Jae Hwang
Soo Jae Hwang

💻
Royston Shufflebotham
Royston Shufflebotham

🐛 💻 📖 ⚠️
Vadim Brodsky
Vadim Brodsky

💻
Eunjae Lee
Eunjae Lee

💻
David Peter
David Peter

💻
Shy Alter
Shy Alter

💻 📖
Łukasz Makuch
Łukasz Makuch

📦
Tyler Haas
Tyler Haas

💻 ⚠️
Vesa Laakso
Vesa Laakso

💻 ⚠️
Tulsi Sapkota
Tulsi Sapkota

💻
Tiago Nunes
Tiago Nunes

💻 ⚠️
JaxCavalera
JaxCavalera

💻 👀
bopfer
bopfer

⚠️
Jan Pfitzner
Jan Pfitzner

💻
David
David

💻
Diego Hernandez
Diego Hernandez

💻 ⚠️
Alex Young
Alex Young

💻
Paul Armstrong
Paul Armstrong

💻 ⚠️
Tamás Szabó
Tamás Szabó

💻 ⚠️
Dylan Piercey
Dylan Piercey

💻 ⚠️
Michael Lasky
Michael Lasky

💻 ⚠️ 📖
Sebastian Silbermann
Sebastian Silbermann

💻 ⚠️ 📖 🚇 👀
Dylan Vann
Dylan Vann

💻
Adrià Fontcuberta
Adrià Fontcuberta

💻 ⚠️ 📖
Thomas Lombart
Thomas Lombart

💻
Sam Horton
Sam Horton

💻 ⚠️
Andrew Hill
Andrew Hill

💻
Jan Amann
Jan Amann

💻 ⚠️
Brais Piñeiro
Brais Piñeiro

💻 ⚠️
Dominykas Blyžė
Dominykas Blyžė

💻 ⚠️
Olzhas Askar
Olzhas Askar

💻 ⚠️ 📖
Max Belsky
Max Belsky

💻 ⚠️
Michael Mantel
Michael Mantel

⚠️
Tom Nagle
Tom Nagle

💻
Westbrook Johnson
Westbrook Johnson

💻
Mohammad Aziz
Mohammad Aziz

💻 ⚠️
seetdev
seetdev

⚠️ 💻
Xavier Garcia Buils
Xavier Garcia Buils

💻 ⚠️
aw-davidson
aw-davidson

💻 ⚠️
Michaël De Boey
Michaël De Boey

💻
Minh Nguyen
Minh Nguyen

💻
Egill Sveinbjörnsson
Egill Sveinbjörnsson

💻
Pavel Pustovalov
Pavel Pustovalov

📖
Adam Palaniuk
Adam Palaniuk

💻 ⚠️
Yama-Tomo
Yama-Tomo

💻 ⚠️
Aaron Pettengill
Aaron Pettengill

💻 ⚠️
Kate W. Boyd
Kate W. Boyd

💻
Rahul Suryakanth
Rahul Suryakanth

💻 ⚠️
Jamie
Jamie

💻 ⚠️
Nicolas Stepien
Nicolas Stepien

💻
Ken Powers
Ken Powers

💻
Michał Zdunek
Michał Zdunek

💻
Ali Nasserzadeh
Ali Nasserzadeh

💻
Darek Kay
Darek Kay

📖 💻 ⚠️
Lukas
Lukas

💻 ⚠️
Tom Crockett
Tom Crockett

💻 ⚠️
Kevin Brewer
Kevin Brewer

💻 ⚠️
Ben Monro
Ben Monro

💻 🤔 ⚠️ 📖
Stephan Meijer
Stephan Meijer

🤔 💻 ⚠️
João Forja
João Forja

💻 ⚠️
Nick McCurdy
Nick McCurdy

📖 💻 ⚠️ 👀 🚇
Caleb Meredith
Caleb Meredith

💻
Marco Moretti
Marco Moretti

💻 ⚠️ 👀
Travis Jefferson
Travis Jefferson

💻 ⚠️
Maciej Jastrzebski
Maciej Jastrzebski

🐛
Geoff Harcourt
Geoff Harcourt

💻
Josh Goldberg
Josh Goldberg

💻 ⚠️
Ken Gregory
Ken Gregory

💻 ⚠️
Jacob Paris
Jacob Paris

💻 ⚠️
keiya sasaki
keiya sasaki

📖
Idan Entin
Idan Entin

💻 ⚠️
Deniz Susman
Deniz Susman

💻
Bianca Del Carretto
Bianca Del Carretto

⚠️ 💻
Josh Lalonde
Josh Lalonde

💻 ⚠️
Ioannis Papadopoulos
Ioannis Papadopoulos

💻 ⚠️
Maxwell Newlands
Maxwell Newlands

💻 ⚠️
Jared Luxenberg
Jared Luxenberg

💻 ⚠️
snizhana
snizhana

💻 ⚠️
Michael van Engelshoven
Michael van Engelshoven

👀
Asher Tuggle
Asher Tuggle

🐛
Winter LaMon
Winter LaMon

💻 ⚠️
Victor Cordova
Victor Cordova

💻 ⚠️
slowselfip
slowselfip

🐛
Dmitry Semigradsky
Dmitry Semigradsky

💻
Adam
Adam

💻 ⚠️
balavishnuvj
balavishnuvj

💻
Chris Colborne
Chris Colborne

💻
Romain Trotard
Romain Trotard

💻
Thomas Marshall
Thomas Marshall

💻 ⚠️
johnjessewood
johnjessewood

🐛 💻
Ari Perkkiö
Ari Perkkiö

🐛 💻 📖
Nathan Force
Nathan Force

💻
Philipp Fritsche
Philipp Fritsche

💻
<img src="https://avatars.githubusercontent.com/u/6964593?v=4?s=100" wid

Current Tags

  • 10.0.0-alpha.3                                ...           alpha (7 months ago)
  • 7.0.0-beta.4                                ...           beta (5 years ago)
  • 10.4.0                                ...           latest (4 months ago)
  • 6.16.0                                ...           next (5 years ago)
  • 8.20.1                                ...           release-8.x (a year ago)

228 Versions

  • 10.4.0                                ...           4 months ago
  • 10.3.2                                ...           4 months ago
  • 10.3.1                                ...           4 months ago
  • 10.3.0                                ...           4 months ago
  • 10.2.0                                ...           5 months ago
  • 10.1.0                                ...           7 months ago
  • 10.0.0                                ...           7 months ago
  • 10.0.0-alpha.3                                ...           7 months ago
  • 9.3.4                                ...           10 months ago
  • 10.0.0-alpha.2                                ...           a year ago
  • 9.3.3                                ...           a year ago
  • 9.3.2                                ...           a year ago
  • 10.0.0-alpha.1                                ...           a year ago
  • 8.20.1                                ...           a year ago
  • 9.3.1                                ...           a year ago
  • 9.3.0                                ...           2 years ago
  • 9.2.0                                ...           2 years ago
  • 9.1.0                                ...           2 years ago
  • 9.0.1                                ...           2 years ago
  • 9.0.0                                ...           2 years ago
  • 9.0.0-alpha.2                                ...           2 years ago
  • 9.0.0-alpha.1                                ...           2 years ago
  • 8.20.0                                ...           2 years ago
  • 8.19.1                                ...           2 years ago
  • 8.19.0                                ...           2 years ago
  • 8.18.1                                ...           2 years ago
  • 8.18.0                                ...           2 years ago
  • 8.17.1                                ...           2 years ago
  • 8.17.0                                ...           2 years ago
  • 8.16.1                                ...           2 years ago
  • 8.16.0                                ...           2 years ago
  • 8.15.0                                ...           2 years ago
  • 8.14.1                                ...           2 years ago
  • 8.14.0                                ...           2 years ago
  • 8.13.0                                ...           3 years ago
  • 8.12.0                                ...           3 years ago
  • 8.11.4                                ...           3 years ago
  • 8.11.3                                ...           3 years ago
  • 8.11.2                                ...           3 years ago
  • 8.11.1                                ...           3 years ago
  • 8.11.0                                ...           3 years ago
  • 8.10.1                                ...           3 years ago
  • 8.10.0                                ...           3 years ago
  • 8.9.1                                ...           3 years ago
  • 8.9.0                                ...           3 years ago
  • 8.7.2                                ...           3 years ago
  • 8.7.1                                ...           3 years ago
  • 8.7.0                                ...           3 years ago
  • 8.6.0                                ...           3 years ago
  • 8.5.0                                ...           3 years ago
  • 8.4.0                                ...           3 years ago
  • 8.3.0                                ...           3 years ago
  • 8.2.0                                ...           3 years ago
  • 8.1.1                                ...           3 years ago
  • 8.1.0                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 8.0.0-alpha.7                                ...           3 years ago
  • 8.0.0-alpha.6                                ...           3 years ago
  • 8.0.0-alpha.5                                ...           3 years ago
  • 8.0.0-alpha.4                                ...           3 years ago
  • 8.0.0-alpha.3                                ...           3 years ago
  • 8.0.0-alpha.2                                ...           3 years ago
  • 8.0.0-alpha.1                                ...           3 years ago
  • 7.31.2                                ...           3 years ago
  • 7.31.1                                ...           3 years ago
  • 7.31.1-alpha.1                                ...           3 years ago
  • 7.31.0                                ...           4 years ago
  • 7.30.4                                ...           4 years ago
  • 7.30.3                                ...           4 years ago
  • 7.30.2                                ...           4 years ago
  • 7.30.1                                ...           4 years ago
  • 7.30.0                                ...           4 years ago
  • 7.29.6                                ...           4 years ago
  • 7.29.5                                ...           4 years ago
  • 7.29.4                                ...           4 years ago
  • 7.29.3                                ...           4 years ago
  • 7.29.2                                ...           4 years ago
  • 7.29.1                                ...           4 years ago
  • 7.29.0                                ...           4 years ago
  • 7.28.1                                ...           4 years ago
  • 7.28.0                                ...           4 years ago
  • 7.27.1                                ...           4 years ago
  • 7.27.0                                ...           4 years ago
  • 7.26.7                                ...           4 years ago
  • 7.26.6                                ...           4 years ago
  • 7.26.5                                ...           4 years ago
  • 7.26.4                                ...           4 years ago
  • 7.26.3                                ...           4 years ago
  • 7.26.2                                ...           4 years ago
  • 7.26.1                                ...           4 years ago
  • 7.26.0                                ...           4 years ago
  • 7.25.0                                ...           4 years ago
  • 7.24.5                                ...           4 years ago
  • 7.24.4                                ...           4 years ago
  • 7.24.3                                ...           4 years ago
  • 7.24.2                                ...           4 years ago
  • 7.24.1                                ...           4 years ago
  • 7.24.0                                ...           4 years ago
  • 7.23.0                                ...           4 years ago
  • 7.22.6                                ...           4 years ago
  • 7.22.5                                ...           4 years ago
  • 7.22.4                                ...           4 years ago
  • 7.22.3                                ...           4 years ago
  • 7.22.2                                ...           4 years ago
  • 7.22.1                                ...           4 years ago
  • 7.22.0                                ...           4 years ago
  • 7.21.8                                ...           4 years ago
  • 7.21.7                                ...           4 years ago
  • 7.21.6                                ...           4 years ago
  • 7.21.5                                ...           4 years ago
  • 7.21.4                                ...           4 years ago
  • 7.21.3                                ...           4 years ago
  • 7.21.2                                ...           4 years ago
  • 7.21.1                                ...           4 years ago
  • 7.21.0                                ...           4 years ago
  • 7.20.2                                ...           4 years ago
  • 7.20.1                                ...           4 years ago
  • 7.20.0                                ...           4 years ago
  • 7.19.0                                ...           4 years ago
  • 7.18.2                                ...           4 years ago
  • 7.18.1                                ...           4 years ago
  • 7.18.0                                ...           4 years ago
  • 7.17.2                                ...           4 years ago
  • 7.17.1                                ...           4 years ago
  • 7.17.0                                ...           4 years ago
  • 7.16.3                                ...           4 years ago
  • 7.16.2-alpha.2                                ...           4 years ago
  • 7.16.2-alpha.1                                ...           4 years ago
  • 7.16.2                                ...           4 years ago
  • 7.16.1                                ...           4 years ago
  • 7.16.0                                ...           4 years ago
  • 7.15.1                                ...           4 years ago
  • 7.15.0                                ...           4 years ago
  • 7.14.3                                ...           4 years ago
  • 7.15.0-alpha.1                                ...           4 years ago
  • 7.14.2                                ...           4 years ago
  • 7.14.1                                ...           4 years ago
  • 7.14.0                                ...           4 years ago
  • 7.13.0                                ...           4 years ago
  • 7.12.0                                ...           4 years ago
  • 7.11.0                                ...           4 years ago
  • 7.10.1                                ...           4 years ago
  • 7.10.0                                ...           4 years ago
  • 7.9.0                                ...           4 years ago
  • 7.8.0                                ...           4 years ago
  • 7.7.3                                ...           4 years ago
  • 7.7.2                                ...           4 years ago
  • 7.7.1                                ...           4 years ago
  • 7.7.0                                ...           4 years ago
  • 7.6.0                                ...           4 years ago
  • 7.5.9                                ...           4 years ago
  • 7.5.8                                ...           4 years ago
  • 7.5.7                                ...           4 years ago
  • 7.5.6                                ...           5 years ago
  • 7.5.5                                ...           5 years ago
  • 7.5.4                                ...           5 years ago
  • 7.5.3                                ...           5 years ago
  • 7.5.2                                ...           5 years ago
  • 7.5.1                                ...           5 years ago
  • 7.5.0                                ...           5 years ago
  • 7.4.0                                ...           5 years ago
  • 7.3.0                                ...           5 years ago
  • 7.2.2                                ...           5 years ago
  • 7.2.1                                ...           5 years ago
  • 7.2.0                                ...           5 years ago
  • 7.1.4                                ...           5 years ago
  • 7.1.3                                ...           5 years ago
  • 7.1.2                                ...           5 years ago
  • 7.1.1                                ...           5 years ago
  • 7.1.0                                ...           5 years ago
  • 7.0.4                                ...           5 years ago
  • 7.0.3                                ...           5 years ago
  • 7.0.2                                ...           5 years ago
  • 7.0.1                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 7.0.0-beta.4                                ...           5 years ago
  • 7.0.0-beta.3                                ...           5 years ago
  • 7.0.0-beta.2                                ...           5 years ago
  • 7.0.0-beta.1                                ...           5 years ago
  • 6.16.0                                ...           5 years ago
  • 6.15.0                                ...           5 years ago
  • 6.14.1                                ...           5 years ago
  • 6.14.0                                ...           5 years ago
  • 6.13.0                                ...           5 years ago
  • 6.12.2                                ...           5 years ago
  • 6.12.1                                ...           5 years ago
  • 6.12.0                                ...           5 years ago
  • 6.11.1                                ...           5 years ago
  • 6.11.0                                ...           5 years ago
  • 6.10.1                                ...           5 years ago
  • 6.10.0                                ...           5 years ago
  • 6.9.0                                ...           5 years ago
  • 6.8.1                                ...           5 years ago
  • 6.8.0                                ...           5 years ago
  • 6.7.1                                ...           5 years ago
  • 6.7.0                                ...           5 years ago
  • 6.6.0                                ...           5 years ago
  • 6.5.1                                ...           5 years ago
  • 6.5.0                                ...           5 years ago
  • 6.4.1                                ...           5 years ago
  • 6.4.0                                ...           5 years ago
  • 6.3.0                                ...           5 years ago
  • 6.2.0                                ...           5 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.1                                ...           5 years ago
  • 6.0.1-alpha.1                                ...           5 years ago
  • 6.0.1-alpha.0                                ...           5 years ago
  • 6.0.0                                ...           5 years ago
  • 5.6.1                                ...           5 years ago
  • 5.6.0                                ...           5 years ago
  • 5.5.6                                ...           5 years ago
  • 5.5.5                                ...           5 years ago
  • 5.5.4                                ...           5 years ago
  • 5.5.3                                ...           5 years ago
  • 5.5.2                                ...           5 years ago
  • 5.5.1                                ...           5 years ago
  • 5.5.0                                ...           5 years ago
  • 5.4.0                                ...           5 years ago
  • 5.3.1                                ...           5 years ago
  • 5.3.0                                ...           5 years ago
  • 5.2.1                                ...           5 years ago
  • 5.2.0                                ...           5 years ago
  • 5.1.1                                ...           5 years ago
  • 5.1.0                                ...           5 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.2.0                                ...           5 years ago
  • 0.0.0                                ...           5 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE