debian-mirror-gitlab/spec/frontend/behaviors/markdown/render_mermaid_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
740 B
JavaScript
Raw Normal View History

2021-04-29 21:17:54 +05:30
import { initMermaid } from '~/behaviors/markdown/render_mermaid';
import * as ColorUtils from '~/lib/utils/color_utils';
describe('Render mermaid diagrams for Gitlab Flavoured Markdown', () => {
it.each`
darkMode | expectedTheme
${false} | ${'neutral'}
${true} | ${'dark'}
`('is $darkMode $expectedTheme', async ({ darkMode, expectedTheme }) => {
jest.spyOn(ColorUtils, 'darkModeEnabled').mockImplementation(() => darkMode);
const mermaid = {
initialize: jest.fn(),
};
await initMermaid(mermaid);
expect(mermaid.initialize).toHaveBeenCalledTimes(1);
expect(mermaid.initialize).toHaveBeenCalledWith(
expect.objectContaining({
theme: expectedTheme,
}),
);
});
});