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
1 change: 1 addition & 0 deletions scripts/fiber/tests-passing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
* findDOMNode should find dom element after expanding a fragment
* should bubble events from the portal to the parent
* should not onMouseLeave when staying in the portal
* should not crash encountering low-priority tree

src/renderers/dom/shared/__tests__/CSSProperty-test.js
* should generate browser prefixes for its `isUnitlessNumber`
Expand Down
8 changes: 5 additions & 3 deletions scripts/jest/environment.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable */
global.__DEV__ = true;

// For testing DOM Fiber, we synchronously invoke all the scheduling.
// For testing DOM Fiber.
global.requestAnimationFrame = function(callback) {
callback();
setTimeout(callback);
};

global.requestIdleCallback = function(callback) {
callback({ timeRemaining() { return Infinity; } });
setTimeout(() => {
callback({ timeRemaining() { return Infinity; } });
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it really matters but

setTimeout(callback, 0, { timeRemaining() { return Infinity; } });

would save an allocation :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I learned. I don't care though—it's tests. 😄

};
9 changes: 9 additions & 0 deletions src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,5 +993,14 @@ describe('ReactDOMFiber', () => {
'leave parent', // Only when we leave the portal does onMouseLeave fire.
]);
});

it('should not crash encountering low-priority tree', () => {
ReactDOM.render(
<div hidden={true}>
<div />
</div>,
container
);
});
}
});