File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ export function toBeInTheDocument(element) {
13
13
const pass =
14
14
element === null ? false : element . ownerDocument . contains ( element )
15
15
16
+ const errorFound = ( ) => {
17
+ return `expected document not to contain element, found ${ stringify (
18
+ element . cloneNode ( true ) ,
19
+ ) } instead`
20
+ }
21
+ const errorNotFound = ( ) => {
22
+ return `element could not be found in the document`
23
+ }
24
+
16
25
return {
17
26
pass,
18
27
message : ( ) => {
@@ -23,10 +32,7 @@ export function toBeInTheDocument(element) {
23
32
'' ,
24
33
) ,
25
34
'' ,
26
- receivedColor ( `${ stringify ( element . ownerDocument . cloneNode ( false ) ) } ${
27
- this . isNot ? 'contains:' : 'does not contain:'
28
- } ${ stringify ( element . cloneNode ( false ) ) }
29
- ` ) ,
35
+ receivedColor ( this . isNot ? errorFound ( ) : errorNotFound ( ) ) ,
30
36
] . join ( '\n' )
31
37
} ,
32
38
}
You can’t perform that action at this time.
0 commit comments