File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
packages/react-test-renderer/src/__tests__ Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,35 @@ describe('ReactTestRenderer', () => {
50
50
expect ( errors [ 1 ] . message . includes ( 'indexOf is not a function' ) ) . toBe ( true ) ;
51
51
} ) ;
52
52
53
+ test ( 'find element by prop with suspended content' , async ( ) => {
54
+ const neverResolve = new Promise ( ( ) => { } ) ;
55
+
56
+ function TestComp ( { foo} ) {
57
+ if ( foo === 'one' ) {
58
+ throw neverResolve ;
59
+ } else {
60
+ return null ;
61
+ }
62
+ }
63
+
64
+ const tree = await act ( ( ) =>
65
+ ReactTestRenderer . create (
66
+ < div >
67
+ < React . Suspense fallback = { null } >
68
+ < TestComp foo = "one" />
69
+ </ React . Suspense >
70
+ < TestComp foo = "two" />
71
+ </ div > ,
72
+ ) ,
73
+ ) ;
74
+
75
+ expect (
76
+ tree . root . find ( item => {
77
+ return item . props . foo === 'two' ;
78
+ } ) ,
79
+ ) . toBeDefined ( ) ;
80
+ } ) ;
81
+
53
82
describe ( 'timed out Suspense hidden subtrees should not be observable via toJSON' , ( ) => {
54
83
let AsyncText ;
55
84
let PendingResources ;
You can’t perform that action at this time.
0 commit comments