debian-mirror-gitlab/spec/frontend/notebook/cells/output/markdown_spec.js

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

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-01-13 00:05:48 +05:30
import { mount } from '@vue/test-utils';
import MarkdownOutput from '~/notebook/cells/output/markdown.vue';
import Prompt from '~/notebook/cells/prompt.vue';
import Markdown from '~/notebook/cells/markdown.vue';
import { relativeRawPath, markdownCellContent } from '../../mock_data';
describe('markdown output cell', () => {
let wrapper;
const createComponent = ({ count = 0, index = 0 } = {}) => {
wrapper = mount(MarkdownOutput, {
provide: { relativeRawPath },
propsData: {
rawCode: markdownCellContent,
count,
index,
},
});
};
beforeEach(() => {
createComponent();
});
const findPrompt = () => wrapper.findComponent(Prompt);
const findMarkdown = () => wrapper.findComponent(Markdown);
it.each`
index | count | showOutput
${0} | ${1} | ${true}
${1} | ${2} | ${false}
${2} | ${3} | ${false}
`('renders a prompt', ({ index, count, showOutput }) => {
createComponent({ count, index });
expect(findPrompt().props()).toMatchObject({ count, showOutput, type: 'Out' });
});
it('renders a Markdown component', () => {
expect(findMarkdown().props()).toMatchObject({
cell: { source: markdownCellContent },
hidePrompt: true,
});
});
});