Skip to content

Commit

Permalink
Mock React.createPortal for react-modal to work in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardxia committed Nov 16, 2020
1 parent 083d9ce commit 2518cf9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jest/loadershim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
global.___loader = {
enqueue: jest.fn(),
};

// Used to allow react-modal to work in tests.
// https://github.com/facebook/react/issues/11565#issuecomment-427547413
jest.mock("react-dom", () => ({
createPortal: (node) => node,
}));

0 comments on commit 2518cf9

Please sign in to comment.