Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[tests] add assertLog for legacy mode tests
  • Loading branch information
rickhanlonii committed Apr 10, 2024
commit 9cd95fa5b0bbb3b6712de0da9d41d8cb9d9426a6
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