File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,29 @@ document.body.innerHTML = exampleHTML
81
81
const exampleInput = screen .getByLabelText (/ example/ i )
82
82
```
83
83
84
+ ### ` screen.debug `
85
+
86
+ For convenience screen also exposes a ` debug ` method in addition to the queries.
87
+ This method is essentially a shortcut for ` console.log(prettyDOM()) ` . It
88
+ supports debugging the document, a single element, or an array of elements.
89
+
90
+ ``` javascript
91
+ import {screen } from ' @testing-library/dom'
92
+
93
+ document .body .innerHTML = `
94
+ <button >test</button >
95
+ <span >multi-test</span >
96
+ <div >multi-test</div >
97
+ `
98
+
99
+ // debug document
100
+ screen .debug ()
101
+ // debug single element
102
+ screen .debug (screen .getByText (' test' ))
103
+ // debug multiple elements
104
+ screen .debug (screen .getAllByText (' multi-test' ))
105
+ ```
106
+
84
107
## Queries
85
108
86
109
> NOTE: These queries are the base queries and require you pass a ` container ` as
You can’t perform that action at this time.
0 commit comments