- Notifications
You must be signed in to change notification settings - Fork466
🐙 Simple and complete DOM testing utilities that encourage good testing practices.
License
testing-library/dom-testing-library
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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 componentsand rather focus on making your tests give you the confidence for which they areintended. As part of this, you want your testbase to be maintainable in the longrun so refactors of your components (changes to implementation but notfunctionality) don't break your tests and slow you and your team down.
TheDOM Testing Library is a very light-weight solution for testing DOM nodes(whether simulated withJSDOM as provided bydefault withJest or in the browser). The main utilities it provides involvequerying the DOM for nodes in a way that's similar to how the user findselements on the page. In this way, the library helps ensure your tests give youconfidence in your UI code. TheDOM Testing Library's primary guidingprinciple is:
The more your tests resemble the way your software is used, the moreconfidence they can give you.
This module is distributed vianpm which is bundled withnode andshould be installed as one of your project'sdevDependencies:
npm install --save-dev @testing-library/domRead the docs (and discover framework and tool-specific implementations) attesting-library.com
The more your tests resemble the way your software is used, the moreconfidence they can give you.
We try to only expose methods and utilities that encourage you to write teststhat closely resemble how your web pages are used.
Utilities are included in this project based on the following guidingprinciples:
- If it relates to rendering components, it deals with DOM nodes rather thancomponent instances, nor should it encourage dealing with componentinstances.
- It should be generally useful for testing the application components in theway the user would use it. Weare making some trade-offs here becausewe're using a computer and often a simulated browser environment, but ingeneral, utilities should encourage tests that use the components the waythey're intended to be used.
- Utility implementations and APIs should be simple and flexible.
At the end of the day, what we want is for this library to be prettylight-weight, simple, and understandable.
Thanks goes to these people (emoji key):
This project follows theall-contributors specification.Contributions of any kind welcome!
About
🐙 Simple and complete DOM testing utilities that encourage good testing practices.
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.

