describe('Markdown widget', () => { describe('quote block', () => { before(() => { Cypress.config('defaultCommandTimeout', 4000); cy.task('setupBackend', { backend: 'test' }); }); beforeEach(() => { cy.loginAndNewPost(); cy.clearMarkdownEditorContent(); }); after(() => { cy.task('teardownBackend', { backend: 'test' }); }); // describe('toggle quote', () => { it('toggles empty quote block on and off in empty editor', () => { cy .clickQuoteButton() .confirmMarkdownEditorContent( `

`, ) .clickQuoteButton().confirmMarkdownEditorContent(`

`); }); it('toggles empty quote block on and off for current block', () => { cy .focused() .type('foo') .clickQuoteButton() .confirmMarkdownEditorContent( `

foo

`, ) .clickQuoteButton().confirmMarkdownEditorContent(`

foo

`); }); it('toggles entire quote block without expanded selection', () => { cy.clickQuoteButton().type('foo').enter().type('bar').clickQuoteButton() .confirmMarkdownEditorContent(`

foo

bar

`); }); it('toggles entire quote block with complex content', () => { cy .clickQuoteButton() .clickUnorderedListButton() .clickHeadingOneButton() .type('foo') .enter({ times: 2 }) // First Enter creates new list item. Second Enter turns that list item into a default block. .clickQuoteButton() // Unwrap the quote block. .confirmMarkdownEditorContent(`

`); }); it('toggles empty quote block on and off for selected blocks', () => { // eslint-disable-next-line cypress/no-unnecessary-waiting cy .focused() .type('foo') .enter() .type('bar') .setSelection('foo', 'bar') .wait(500) .clickQuoteButton() .confirmMarkdownEditorContent( `

foo

bar

`, ) .clickQuoteButton() .confirmMarkdownEditorContent( `

foo

bar

`, ) .clickQuoteButton().confirmMarkdownEditorContent(`

foo

bar

`); }); it('toggles empty quote block on and off for partially selected blocks', () => { // eslint-disable-next-line cypress/no-unnecessary-waiting cy .focused() .type('foo') .enter() .type('bar') .setSelection('oo', 'ba') .wait(500) .clickQuoteButton() .confirmMarkdownEditorContent( `

foo

bar

`, ) .clickQuoteButton() .confirmMarkdownEditorContent( `

foo

bar

`, ) .clickQuoteButton().confirmMarkdownEditorContent(`

foo

bar

`); }); it('toggles quote block on and off for multiple selected list items', () => { // eslint-disable-next-line cypress/no-unnecessary-waiting cy .focused() .clickUnorderedListButton() .type('foo') .enter() .type('bar') .setSelection('foo', 'bar') .wait(500) .clickQuoteButton() .confirmMarkdownEditorContent( `
`, ) .clickQuoteButton() .confirmMarkdownEditorContent( ` `, ) .setCursorAfter('bar') .wait(500) .enter() .type('baz') .setSelection('bar', 'baz') .wait(500) .clickQuoteButton().confirmMarkdownEditorContent(`
`); }); it('creates new quote block if parent is not a quote, can deeply nest', () => { cy.clickQuoteButton() .clickUnorderedListButton() .clickQuoteButton() .clickUnorderedListButton() .clickQuoteButton() .clickUnorderedListButton() .clickQuoteButton() .type('foo') // Content should contains 4
tags and 3