diff --git a/src/sql/workbench/contrib/notebook/test/browser/notebookMarkdown.test.ts b/src/sql/workbench/contrib/notebook/test/browser/notebookMarkdown.test.ts index 7d320350a1..083f2d13a6 100644 --- a/src/sql/workbench/contrib/notebook/test/browser/notebookMarkdown.test.ts +++ b/src/sql/workbench/contrib/notebook/test/browser/notebookMarkdown.test.ts @@ -103,4 +103,53 @@ suite('NotebookMarkdownRenderer', () => { result = notebookMarkdownRenderer.renderMarkdown({ value: `![altText](attachment:ads.png)`, isTrusted: true }, { cellAttachments: JSON.parse('{"ads2.png":"image/png"}') }); assert.strictEqual(result.innerHTML, `

altText

`, 'Cell attachment no image data failed'); }); + + /** + * This suite contains tests that verify the expected parsing results for the current version of marked.js which were determined to have + * changed in newer versions of marked.js being brought in. They are put here as a staging ground to keep track of these differences, but once the + * differences are understood should be moved out into a generic test like the ones above. + */ + suite('parse output differences between current marked.js and newer versions', function (): void { + test('1', function (): void { + const markdown = '1) Item 1\n\n2) Item 2\n\n 1) Sub-item 1\n\n 2) Sub-item 2\n\n'; + const expectedValue = '
    \n
  1. Item 1

  2. \n
  3. Item 2

      \n
    1. Sub-item 1

    2. \n
    3. Sub-item 2

    4. \n
    \n
  4. \n
\n'; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + + test('2', function (): void { + const markdown = ' ![](attachment:image.png)'; + const expectedValue = '
![](attachment:image.png)
\n'; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + + test('3', function (): void { + const markdown = 'Some text **%appdata%\\*****Path\\\\To\\\\Folder\\\\<******FileName**>.ext** into **...\\\\Another\\\\****Path\\\\**\n\n'; + const expectedValue = '

Some text %appdata%***Path\\To\\Folder\\<******FileName**>.ext** into ...\\Another\\**Path\\**

'; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + + test('4', function (): void { + const markdown = '# Heading 1\n- Some text\n\n \n\n- ## Heading 2'; + const expectedValue = '

Heading 1

\n\n\n'; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + + test('5', function (): void { + const markdown = `Some text\n\n Some more text`; + const expectedValue = '

Some text

  Some more text
\n'; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + + test('6', function (): void { + const markdown = `# heading\n##`; + const expectedValue = `

heading

\n

##

`; + const result = notebookMarkdownRenderer.renderMarkdown({ value: markdown, isTrusted: true }).innerHTML; + assert.strictEqual(result, expectedValue); + }); + }); });