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