import '../utils/dismiss-local-backup'; describe('Markdown widget', () => { before(() => { Cypress.config('defaultCommandTimeout', 4000); cy.task('setupBackend', { backend: 'test' }); cy.loginAndNewPost(); }); beforeEach(() => { cy.clearMarkdownEditorContent(); }); after(() => { cy.task('teardownBackend', { backend: 'test' }); }); describe('pressing backspace', () => { it('sets non-default block to default when empty', () => { cy.focused() .clickHeadingOneButton() .backspace() .confirmMarkdownEditorContent(`
`); }); it('moves to previous block when no character left to delete', () => { cy.focused() .type('foo') .enter() .clickHeadingOneButton() .type('a') .backspace({times: 2}) .confirmMarkdownEditorContent(`foo
`); }); it('does nothing at start of first block in document when non-empty and non-default', () => { cy.focused() .clickHeadingOneButton() .type('foo') .setCursorBefore('foo') .backspace({ times: 4 }) .confirmMarkdownEditorContent(`foo
foobarbaz
`); }); }); });