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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-18 18:09:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-18 18:09:08 +0300
commitcc1066db64a2a283a3d229b9bbb67c01716ca871 (patch)
treec5a518fabe9bb87b17a1f99b6c2616144170ebeb /spec/frontend/lib/gfm/index_spec.js
parent5c5d24f032b67d98452f391192386e330a0f880c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/gfm/index_spec.js')
-rw-r--r--spec/frontend/lib/gfm/index_spec.js71
1 files changed, 49 insertions, 22 deletions
diff --git a/spec/frontend/lib/gfm/index_spec.js b/spec/frontend/lib/gfm/index_spec.js
index 7aab0072364..b722315d63a 100644
--- a/spec/frontend/lib/gfm/index_spec.js
+++ b/spec/frontend/lib/gfm/index_spec.js
@@ -1,11 +1,12 @@
import { render } from '~/lib/gfm';
describe('gfm', () => {
- const markdownToAST = async (markdown) => {
+ const markdownToAST = async (markdown, skipRendering = []) => {
let result;
await render({
markdown,
+ skipRendering,
renderer: (tree) => {
result = tree;
},
@@ -58,36 +59,62 @@ describe('gfm', () => {
expect(result).toEqual(rendered);
});
- it('transforms footnotes into footnotedefinition and footnotereference tags', async () => {
- const result = await markdownToAST(
- `footnote reference [^footnote]
+ describe('when skipping the rendering of footnote reference and definition nodes', () => {
+ it('transforms footnotes into footnotedefinition and footnotereference tags', async () => {
+ const result = await markdownToAST(
+ `footnote reference [^footnote]
[^footnote]: Footnote definition`,
- );
+ ['footnoteReference', 'footnoteDefinition'],
+ );
- expectInRoot(
- result,
- expect.objectContaining({
- children: expect.arrayContaining([
- expect.objectContaining({
- type: 'element',
- tagName: 'footnotereference',
- properties: {
- identifier: 'footnote',
- label: 'footnote',
- },
- }),
- ]),
- }),
+ expectInRoot(
+ result,
+ expect.objectContaining({
+ children: expect.arrayContaining([
+ expect.objectContaining({
+ type: 'element',
+ tagName: 'footnotereference',
+ properties: {
+ identifier: 'footnote',
+ label: 'footnote',
+ },
+ }),
+ ]),
+ }),
+ );
+
+ expectInRoot(
+ result,
+ expect.objectContaining({
+ tagName: 'footnotedefinition',
+ properties: {
+ identifier: 'footnote',
+ label: 'footnote',
+ },
+ }),
+ );
+ });
+ });
+ });
+
+ describe('when skipping the rendering of code blocks', () => {
+ it('transforms code nodes into codeblock html tags', async () => {
+ const result = await markdownToAST(
+ `
+\`\`\`javascript
+console.log('Hola');
+\`\`\`\
+ `,
+ ['code'],
);
expectInRoot(
result,
expect.objectContaining({
- tagName: 'footnotedefinition',
+ tagName: 'codeblock',
properties: {
- identifier: 'footnote',
- label: 'footnote',
+ language: 'javascript',
},
}),
);