Skip to content

Commit

Permalink
test: extend cases of parsing XML-like text
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Feb 7, 2025
1 parent 9bf4a7f commit d440a46
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/component/components/NcRichText/markown-rendering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,54 @@
import { expect, test } from '@playwright/experimental-ct-vue'
import NcRichText from '../../../../src/components/NcRichText/NcRichText.vue'

test.describe('XML-like text (escaped and unescaped)', () => {
const TEST = '<span>text</span> &lt;span&gt;text&lt;/span&gt;'
test('renders normal text as passed', async ({ mount }) => {
const component = await mount(NcRichText, {
props: {
text: TEST,
},
})
await expect(component.getByText(TEST)).toBeVisible()
})
test('renders with Markdown, escaping XML', async ({ mount }) => {
const component = await mount(NcRichText, {
props: {
text: TEST,
useMarkdown: true,
},
})
await expect(component.getByRole('paragraph')).toContainText('<span>text</span> <span>text</span>')
})
test('renders with Markdown, escaping XML in code', async ({ mount }) => {
const component = await mount(NcRichText, {
props: {
text: '```\n' + TEST + '\n```',
useMarkdown: true,
},
})
await expect(component.getByRole('code')).toContainText('<span>text</span> <span>text</span>' + '\n')
})
test('renders with Flavored Markdown, escaping XML', async ({ mount }) => {
const component = await mount(NcRichText, {
props: {
text: TEST,
useExtendedMarkdown: true,
},
})
await expect(component.getByRole('paragraph')).toContainText('<span>text</span> <span>text</span>')
})
test('renders with Flavored Markdown, escaping XML in code', async ({ mount }) => {
const component = await mount(NcRichText, {
props: {
text: '```\n' + TEST + '\n```',
useExtendedMarkdown: true,
},
})
await expect(component.getByRole('code')).toContainText('<span>text</span> <span>text</span>' + '\n')
})
})

test.describe('dividers', () => {
test('dividers with asterisks', async ({ mount }) => {
const component = await mount(NcRichText, {
Expand Down

0 comments on commit d440a46

Please sign in to comment.