Skip to content

Commit

Permalink
Test for ReactTestRenderer (#28674)
Browse files Browse the repository at this point in the history
This is a repro for a breakage that #28672 would introduce for legacy
sync rendering.
  • Loading branch information
kassens committed Mar 29, 2024
1 parent 18812b6 commit 23b32d3
Showing 1 changed file with 29 additions and 0 deletions.
Expand Up @@ -50,6 +50,35 @@ describe('ReactTestRenderer', () => {
expect(errors[1].message.includes('indexOf is not a function')).toBe(true);
});

test('find element by prop with suspended content', async () => {
const neverResolve = new Promise(() => {});

function TestComp({foo}) {
if (foo === 'one') {
throw neverResolve;
} else {
return null;
}
}

const tree = await act(() =>
ReactTestRenderer.create(
<div>
<React.Suspense fallback={null}>
<TestComp foo="one" />
</React.Suspense>
<TestComp foo="two" />
</div>,
),
);

expect(
tree.root.find(item => {
return item.props.foo === 'two';
}),
).toBeDefined();
});

describe('timed out Suspense hidden subtrees should not be observable via toJSON', () => {
let AsyncText;
let PendingResources;
Expand Down

0 comments on commit 23b32d3

Please sign in to comment.