summaryrefslogtreecommitdiff
path: root/spec/frontend/content_editor/markdown_processing_spec.js
blob: cb34476d680df376bdd5cac0d9eb80629922b67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { createContentEditor } from '~/content_editor';
import { loadMarkdownApiExamples, loadMarkdownApiResult } from './markdown_processing_examples';

describe('markdown processing', () => {
  // Ensure we generate same markdown that was provided to Markdown API.
  it.each(loadMarkdownApiExamples())('correctly handles %s', async (testName, markdown) => {
    const { html } = loadMarkdownApiResult(testName);
    const contentEditor = createContentEditor({ renderMarkdown: () => html });
    await contentEditor.setSerializedContent(markdown);

    expect(contentEditor.getSerializedContent()).toBe(markdown);
  });
});