Skip to content

Commit

Permalink
mock euicode in storyshots
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Feb 11, 2020
1 parent 4b31e80 commit ee54d9d
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 616 deletions.
13 changes: 13 additions & 0 deletions x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ Date.now = jest.fn(() => testTime);
// Mock EUI generated ids to be consistently predictable for snapshots.
jest.mock(`@elastic/eui/lib/components/form/form_row/make_id`, () => () => `generated-id`);

// Mocking to prevent errors with React portal.
// Temporary until https://github.com/elastic/kibana/pull/55877 provides other alternatives.
jest.mock('@elastic/eui/lib/components/code/code', () => {
const React = require.requireActual('react');
return {
EuiCode: ({children, className}) => (
<span>
<code>{children}</code>
</span>
),
};
});

// Jest automatically mocks SVGs to be a plain-text string that isn't an SVG. Canvas uses
// them in examples, so let's mock a few for tests.
jest.mock('../canvas_plugin_src/renderers/shape/shapes', () => ({
Expand Down
Loading

0 comments on commit ee54d9d

Please sign in to comment.