Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable7] - backport for Rich components changes #4526

Merged
merged 13 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 40 additions & 5 deletions cypress/component/richtext.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ import NcRichText from '../../src/components/NcRichText/NcRichText.vue'

describe('NcRichText', () => {
describe('renders with markdown', () => {
describe('normal text', () => {
it('XML-like text (escaped and unescaped)', () => {
mount(NcRichText, {
propsData: {
text: '<span>text&lt;/span&gt;',
useMarkdown: true,
},
})

cy.get('p').should('have.text', '<span>text</span>')
})
})

describe('headings', () => {
it('heading (with hash (#) syntax divided with space from text)', () => {
const testCases = [
Expand Down Expand Up @@ -274,6 +287,17 @@ describe('NcRichText', () => {

cy.get('code').should('have.text', 'inline code')
})

it('inline code (with ignored bold, italic, XML-like syntax))', () => {
mount(NcRichText, {
propsData: {
text: '`inline code **bold text** _italic text_ <span>text&lt;/span&gt;`',
useMarkdown: true,
},
})

cy.get('code').should('have.text', 'inline code **bold text** _italic text_ <span>text</span>')
})
})

describe('multiline code', () => {
Expand Down Expand Up @@ -333,20 +357,20 @@ describe('NcRichText', () => {
cy.get('code').should('have.text', 'line 1\nline 2\nline 3\n')
})

it('multiline code (with ignored bold, italic, inline code syntax)', () => {
it('multiline code (with ignored bold, italic, inline code, XML-like syntax)', () => {
mount(NcRichText, {
propsData: {
text: '```\n**bold text**\n_italic text_\n`inline code`\n```',
text: '```\n**bold text**\n_italic text_\n`inline code`\n<span>text&lt;/span&gt;\n```',
useMarkdown: true,
},
})

cy.get('pre').should('have.text', '**bold text**\n_italic text_\n`inline code`\n')
cy.get('pre').should('have.text', '**bold text**\n_italic text_\n`inline code`\n<span>text</span>\n')
})
})

describe('blockquote', () => {
it('blockquote (with greater then (gt >) syntax)', () => {
it('blockquote (with greater then (>) syntax - normal)', () => {
mount(NcRichText, {
propsData: {
text: '> blockquote',
Expand All @@ -357,6 +381,17 @@ describe('NcRichText', () => {
cy.get('blockquote').should('have.text', '\nblockquote\n')
})

it('blockquote (with greater then (&gt;) syntax - escaped)', () => {
mount(NcRichText, {
propsData: {
text: '&gt; blockquote',
useMarkdown: true,
},
})

cy.get('blockquote').should('have.text', '\nblockquote\n')
})

it('blockquote (with bold, italic text, inline code)', () => {
mount(NcRichText, {
propsData: {
Expand Down Expand Up @@ -401,7 +436,7 @@ describe('NcRichText', () => {
},
})

cy.get('blockquote').should('have.text', '\nline 1\n\nline 3\n')
cy.get('blockquote').should('have.text', '\nline 1\nline 3\n')
})

it('blockquote (with nested blockquote)', () => {
Expand Down
2 changes: 1 addition & 1 deletion l10n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,5 @@ msgstr ""
msgid "Undo changes"
msgstr ""

msgid "Write message, use \"@\" to mention someone, use \":\" for emoji autocompletion …"
msgid "Write a message …"
msgstr ""