@@ -5,20 +5,19 @@ title: Introduction
5
5
6
6
## The problem
7
7
8
- You want to write maintainable tests for your Web UI. As a part of
9
- this goal, you want your tests to avoid including implementation details of
10
- your components and rather focus on making your tests give you the confidence
11
- for which they are intended. As part of this, you want your testbase to be
12
- maintainable in the long run so refactors of your components (changes to
13
- implementation but not functionality) don't break your tests and slow you and
14
- your team down.
8
+ You want to write maintainable tests for your Web UI. As a part of this goal,
9
+ you want your tests to avoid including implementation details of your components
10
+ and rather focus on making your tests give you the confidence for which they are
11
+ intended. As part of this, you want your testbase to be maintainable in the long
12
+ run so refactors of your components (changes to implementation but not
13
+ functionality) don't break your tests and slow you and your team down.
15
14
16
15
## This solution
17
16
18
17
The ` dom-testing-library ` is a very light-weight solution for testing DOM nodes
19
18
(whether simulated with [ ` JSDOM ` ] ( https://github.com/jsdom/jsdom ) as provided by
20
- default with [ Jest] [ jest ] or in the browser). The main utilities it provides involve
21
- querying the DOM for nodes in a way that's similar to how the user finds
19
+ default with [ Jest] [ jest ] or in the browser). The main utilities it provides
20
+ involve querying the DOM for nodes in a way that's similar to how the user finds
22
21
elements on the page. In this way, the library helps ensure your tests give you
23
22
confidence in your UI code. The ` dom-testing-library ` 's primary guiding
24
23
principle is:
@@ -27,10 +26,10 @@ principle is:
27
26
28
27
As part of this goal, the utilities this library provides facilitate querying
29
28
the DOM in the same way the user would. Finding for elements by their label text
30
- (just like a user would), finding links and buttons from their text
31
- (like a user would), and more. It also exposes a recommended way to find
32
- elements by a ` data-testid ` as an "escape hatch" for elements where the text
33
- content and label do not make sense or is not practical.
29
+ (just like a user would), finding links and buttons from their text (like a user
30
+ would), and more. It also exposes a recommended way to find elements by a
31
+ ` data-testid ` as an "escape hatch" for elements where the text content and label
32
+ do not make sense or is not practical.
34
33
35
34
This library encourages your applications to be more accessible and allows you
36
35
to get your tests closer to using your components the way a user will, which
@@ -40,7 +39,8 @@ when a real user uses it.
40
39
** What this library is not** :
41
40
42
41
1 . A test runner or framework
43
- 2 . Specific to a testing framework (though we recommend Jest as our
44
- preference, the library works with any framework. See [ Using Without Jest] ( setup.md#using-without-jest ) )
42
+ 2 . Specific to a testing framework (though we recommend Jest as our preference,
43
+ the library works with any framework. See
44
+ [ Using Without Jest] ( setup.md#using-without-jest ) )
45
45
46
- [ jest ] : https://jestjs.io
46
+ [ jest ] : https://jestjs.io
0 commit comments