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