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) {
1313 const pass =
1414 element === null ? false : element . ownerDocument . contains ( element )
1515
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+
1625 return {
1726 pass,
1827 message : ( ) => {
@@ -23,10 +32,7 @@ export function toBeInTheDocument(element) {
2332 '' ,
2433 ) ,
2534 '' ,
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 ( ) ) ,
3036 ] . join ( '\n' )
3137 } ,
3238 }
You can’t perform that action at this time.
0 commit comments