File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export class ToBeEmptyElementAssertion extends Assertion<ReactTestInstance> {
4040 } ) ;
4141
4242 return this . execute ( {
43- assertWhen : isEmpty ( this . actual ) ,
43+ assertWhen : isEmpty ( this . actual . children ) ,
4444 error,
4545 invertedError,
4646 } ) ;
Original file line number Diff line number Diff line change 1- import { ReactTestInstance } from "react-test-renderer" ;
2-
3- export function isEmpty ( element : ReactTestInstance ) : boolean {
4- const children = element ?. children ;
5-
6- if ( ! children ) {
1+ /**
2+ * Checks if a value is empty.
3+ *
4+ * @param value - The value to check.
5+ * @returns `true` if the value is empty, `false` otherwise.
6+ */
7+ export function isEmpty ( value : unknown ) : boolean {
8+ if ( ! value ) {
79 return true ;
810 }
911
10- if ( Array . isArray ( children ) ) {
11- return children . length === 0 ;
12+ if ( Array . isArray ( value ) ) {
13+ return value . length === 0 ;
1214 }
1315
1416 return false ;
You can’t perform that action at this time.
0 commit comments