Welcome to mirror list, hosted at ThFree Co, Russian Federation.

markdown_processing_spec.js « content_editor « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: da3f6e64db87f1316c92ed49c7dc67d8415f0f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { createContentEditor } from '~/content_editor';
import { loadMarkdownApiExamples, loadMarkdownApiResult } from './markdown_processing_examples';

jest.mock('~/emoji');

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

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