debian-mirror-gitlab/spec/frontend/content_editor/markdown_processing_spec.js

21 lines
738 B
JavaScript
Raw Normal View History

2021-06-08 01:23:25 +05:30
import { createContentEditor } from '~/content_editor';
2021-04-29 21:17:54 +05:30
import { loadMarkdownApiExamples, loadMarkdownApiResult } from './markdown_processing_examples';
2021-10-27 15:23:28 +05:30
jest.mock('~/emoji');
2021-04-29 21:17:54 +05:30
describe('markdown processing', () => {
// Ensure we generate same markdown that was provided to Markdown API.
2021-09-30 23:02:18 +05:30
it.each(loadMarkdownApiExamples())(
'correctly handles %s (context: %s)',
async (name, context, markdown) => {
const testName = context ? `${context}_${name}` : name;
2021-11-11 11:23:49 +05:30
const contentEditor = createContentEditor({
renderMarkdown: () => loadMarkdownApiResult(testName),
});
2021-09-30 23:02:18 +05:30
await contentEditor.setSerializedContent(markdown);
2021-04-29 21:17:54 +05:30
2021-09-30 23:02:18 +05:30
expect(contentEditor.getSerializedContent()).toBe(markdown);
},
);
2021-04-29 21:17:54 +05:30
});