Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] add assertLog for legacy mode tests #28814

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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