Skip to content

Commit

Permalink
[tests] add assertLog for legacy mode tests (facebook#28814)
Browse files Browse the repository at this point in the history
A few more tests for facebook#28737
  • Loading branch information
rickhanlonii authored and AndyPengc12 committed Apr 15, 2024
1 parent 68ec6df commit 9cd2d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
expect(window.getComputedStyle(divs[0].current).display).toEqual('none');
expect(window.getComputedStyle(divs[1].current).display).toEqual('none');
expect(window.getComputedStyle(divs[2].current).display).toEqual('none');

assertLog(['A', 'Suspend! [B]', 'C', 'Loading...']);
await act(async () => {
await resolveText('B');
});
Expand All @@ -141,6 +141,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
expect(window.getComputedStyle(divs[1].current).display).toEqual('block');
// This div's display was set with a prop.
expect(window.getComputedStyle(divs[2].current).display).toEqual('inline');
assertLog(['B']);
});

it('hides and unhides timed out text nodes', async () => {
Expand Down Expand Up @@ -203,6 +204,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
'<span style="display: none;">Sibling</span><span style=' +
'"display: none;"></span>Loading...',
);
assertLog(['Suspend! [Async]', 'Loading...']);

// Update the inline display style. It will be overridden because it's
// inside a hidden fallback.
Expand All @@ -211,6 +213,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
'<span style="display: none;">Sibling</span><span style=' +
'"display: none;"></span>Loading...',
);
assertLog(['Suspend! [Async]']);

// Unsuspend. The style should now match the inline prop.
await act(() => resolveText('Async'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,7 @@ describe('ReactLegacyUpdates', () => {
await act(() => {
ReactDOM.render(<Terminating />, container);
});
assertLog(Array.from({length: LIMIT + 1}, (_, k) => k));
expect(container.textContent).toBe('50');
await act(() => {
_setStep(0);
Expand Down

0 comments on commit 9cd2d04

Please sign in to comment.