10.0.0 • Published 11 days ago

@testing-library/dom v10.0.0

Weekly downloads
4,485,846
License
MIT
Repository
github
Last release
11 days ago

Read the docs | Edit the docs

Build Status Code Coverage version downloads MIT License All Contributors PRs Welcome Code of Conduct Discord

Watch on GitHub Star on GitHub Tweet

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.

Installation

This module is distributed via npm which is bundled with 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.

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):

@testing-library/react@types/testing-library__dom@pingux/astro@rpcbase/webpack-browserint-testsmaccabipwa-femui-table-reactjest-preset-contourinitials-placeholdercra-template-teemsly-starter@rakuten-rampage/rampagereact-datatable-search-paginationreact-styled-components-ui@hackingbay/react-package-boilerplate@eaf.dev/react-hook-use-fetch@eaf.dev/react-router-web@kurtzgmbh/front-react-appe2e-cxs-componentsgbc-test-2@everything-registry/sub-chunk-908test-modal-component-2test-modal-component-7test-modal-component-8decoris2dev-router-vivoember-testing-libraryenduthemepackenduthepackenducompendupack2endupack22react-piano-uireact-router-iba-devdoloremadcra-template-js@diconium/ui-toolboxrzhm-uirole-selectorscaffoldr-reactreact-showroomreact-sms77react_tutorial_tsreshow-unitrescript-dom-testing-libraryreact-traphretail-react-appreact-select-eventreact-select-event-focus-fix-testreact-select-awesomereact-select-without-annrichie-educationriot-testing-librarysolid-testing-librarycreate-vam-reactdm-widgetdm3-messenger-widgetdm3-reactdm-packdiggo-plugincapslockx.jscalliope-ssg@azzykesuma/test-npm-3panix@benbender/jest-config@calebeby/preact-testing-library@capitalg/preact-testing-library@captalys-platform/test-development-kitcipherguard-styleguide@bruno_crosier/cypress-testing-librarypiral-jest-utils@carv/testing-library@chance/ui-test-utils@citolab/tspci@changeset-test123/test-utilsplaywright-testing-library@charlytoc/domlearnpack-domliferay-npm-scripts@symfony/stimulus-testinglunchbox-design-corepronovix-drupal-devpronovix-frontend-toolspptr-testing-library@code-hike/sim-usercomponents-front-endpreact-testing-library-next@cross2d/sim-user@bonitour/orb-corepassbolt-styleguide@bmvantunes/testing-library@curve-technology/web-ds@cutting/devtoolscrank-testing-librarycra-template-ts@braniac/virtual-grid@bondi-js/clipe2e-cxs-components@apitree.cz/testing-librarybisonapp
10.0.0

11 days ago

10.0.0-alpha.3

15 days ago

9.3.4

3 months ago

9.3.3

7 months ago

9.3.2

7 months ago

10.0.0-alpha.2

7 months ago

10.0.0-alpha.1

7 months ago

9.3.1

10 months ago

8.20.1

10 months ago

9.3.0

11 months ago

9.0.1

1 year ago

9.1.0

1 year ago

9.2.0

1 year ago

9.0.0

1 year ago

9.0.0-alpha.2

1 year ago

9.0.0-alpha.1

1 year ago

8.19.1

1 year ago

8.20.0

1 year ago

8.19.0

2 years ago

8.18.0

2 years ago

8.18.1

2 years ago

8.14.0

2 years ago

8.14.1

2 years ago

8.15.0

2 years ago

8.16.0

2 years ago

8.16.1

2 years ago

8.17.1

2 years ago

8.17.0

2 years ago

8.13.0

2 years ago

8.11.4

2 years ago

8.12.0

2 years ago

8.11.3

2 years ago

8.11.2

2 years ago

8.11.1

2 years ago

8.11.0

2 years ago

8.10.0

3 years ago

8.10.1

3 years ago

8.9.0

3 years ago

8.9.1

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.4.0

3 years ago

8.5.0

3 years ago

8.3.0

3 years ago

8.1.1

3 years ago

8.2.0

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.5

3 years ago

8.0.0-alpha.6

3 years ago

8.0.0-alpha.3

3 years ago

8.0.0-alpha.4

3 years ago

8.0.0-alpha.1

3 years ago

8.0.0-alpha.2

3 years ago

7.31.1-alpha.1

3 years ago

7.31.2

3 years ago

7.31.1

3 years ago

7.31.0

3 years ago

7.30.4

3 years ago

7.30.3

3 years ago

7.30.2

3 years ago

7.30.1

3 years ago

7.30.0

3 years ago

7.29.6

3 years ago

7.29.5

3 years ago

7.29.4

3 years ago

7.29.3

3 years ago

7.29.2

3 years ago

7.29.1

3 years ago

7.29.0

3 years ago

7.28.1

3 years ago

7.28.0

3 years ago

7.27.1

3 years ago

7.27.0

3 years ago

7.26.7

3 years ago

7.26.6

3 years ago

7.26.5

3 years ago

7.26.4

3 years ago

7.26.3

3 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.4

4 years ago

7.22.6

4 years ago

7.22.5

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.18.2

4 years ago

7.19.0

4 years ago

7.18.1

4 years ago

7.18.0

4 years ago

7.17.2

4 years ago

7.17.0

4 years ago

7.17.1

4 years ago

7.16.2-alpha.1

4 years ago

7.16.2-alpha.2

4 years ago

7.16.3

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.0

4 years ago

7.14.1

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

4 years ago

7.5.5

4 years ago

7.5.3

4 years ago

7.5.4

4 years ago

7.5.2

4 years ago

7.5.1

4 years ago

7.5.0

4 years ago

7.4.0

4 years ago

7.3.0

4 years ago

7.2.2

4 years ago

7.2.1

4 years ago

7.2.0

4 years ago

7.1.4

4 years ago

7.1.3

4 years ago

7.1.2

4 years ago

7.1.1

4 years ago

7.1.0

4 years ago

7.0.4

4 years ago

7.0.3

4 years ago

7.0.0

4 years ago

7.0.2

4 years ago

7.0.1

4 years ago

6.15.0

4 years ago

6.16.0

4 years ago

6.14.1

4 years ago

6.14.0

4 years ago

7.0.0-beta.4

4 years ago

7.0.0-beta.2

4 years ago

7.0.0-beta.3

4 years ago

7.0.0-beta.1

4 years ago

6.13.0

4 years ago

6.12.2

4 years ago

6.12.1

4 years ago

6.12.0

4 years ago

6.11.1

4 years ago

6.11.0

4 years ago

6.10.1

4 years ago

6.10.0

4 years ago

6.9.0

4 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