From 71cc626b0ad3f6645041a06fcf75a3e99e96296b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 15 Sep 2020 00:07:00 +0200 Subject: [PATCH] refactoring --- .../demos/Extensions/Blockquote/index.spec.js | 60 +++++++++++++------ docs/src/demos/Extensions/Bold/index.spec.js | 4 +- docs/src/demos/Extensions/Code/index.spec.js | 23 +++++-- .../demos/Extensions/CodeBlock/index.spec.js | 48 ++++++++++----- .../demos/Extensions/HardBreak/index.spec.js | 33 +++++++--- .../demos/Extensions/Heading/index.spec.js | 36 ++++++++--- .../demos/Extensions/History/index.spec.js | 45 +++++++++----- .../Extensions/HorizontalRule/index.spec.js | 33 +++++++--- .../src/demos/Extensions/Italic/index.spec.js | 37 ++++++++---- .../demos/Extensions/Paragraph/index.spec.js | 35 +++++++---- .../src/demos/Extensions/Strike/index.spec.js | 38 ++++++++---- .../demos/Extensions/Underline/index.spec.js | 38 ++++++++---- 12 files changed, 307 insertions(+), 123 deletions(-) diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index e378f681..f3424964 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -11,34 +11,60 @@ context('/api/extensions/blockquote', () => { }) it('the button should make the selected line a blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') + cy.get('.ProseMirror blockquote') + .should('not.exist') + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('blockquote') + .should('contain', 'Example Text') }) it('the button should toggle the blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') + cy.get('.ProseMirror blockquote') + .should('not.exist') - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror blockquote').should('not.exist') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('blockquote') + .should('contain', 'Example Text') + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror blockquote') + .should('not.exist') }) it('the keyboard shortcut should make the selected line a blockquote', () => { - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) - cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) + .find('blockquote') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) - cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') + cy.get('.ProseMirror blockquote') + .should('not.exist') - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) - cy.get('.ProseMirror blockquote').should('not.exist') + cy.get('.ProseMirror') + .trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) + .find('blockquote') + .should('contain', 'Example Text') + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + .trigger('keydown', { shiftKey: true, modKey: true, key: '9' }) + + cy.get('.ProseMirror blockquote') + .should('not.exist') }) it('should make a blockquote from markdown shortcuts', () => { diff --git a/docs/src/demos/Extensions/Bold/index.spec.js b/docs/src/demos/Extensions/Bold/index.spec.js index b5937f9c..4b87d663 100644 --- a/docs/src/demos/Extensions/Bold/index.spec.js +++ b/docs/src/demos/Extensions/Bold/index.spec.js @@ -12,7 +12,9 @@ context('/api/extensions/bold', () => { it('the button should make the selected text bold', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('strong').should('contain', 'Example Text') + cy.get('.ProseMirror') + .find('strong') + .should('contain', 'Example Text') }) it('the button should toggle the selected text bold', () => { diff --git a/docs/src/demos/Extensions/Code/index.spec.js b/docs/src/demos/Extensions/Code/index.spec.js index 4556bf9a..bf35d9d9 100644 --- a/docs/src/demos/Extensions/Code/index.spec.js +++ b/docs/src/demos/Extensions/Code/index.spec.js @@ -11,14 +11,25 @@ context('/api/extensions/code', () => { }) it('should mark the selected text as inline code', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('code').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('code') + .should('contain', 'Example Text') }) it('should toggle the selected text as inline code', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror code').should('not.exist') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror code') + .should('not.exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index 1927c050..ff7353b6 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -11,31 +11,51 @@ context('/api/extensions/code-block', () => { }) it('the button should make the selected line a code block', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('pre') + .should('contain', 'Example Text') }) it('the button should toggle the code block', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror pre').should('not.exist') + cy.get('.ProseMirror') + .find('pre') + .should('contain', 'Example Text') + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror pre') + .should('not.exist') }) it('the keyboard shortcut should make the selected line a code block', () => { - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) - cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) + .find('pre') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the code block', () => { - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) - cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) + .find('pre') + .should('contain', 'Example Text') - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) - cy.get('.ProseMirror pre').should('not.exist') + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + .trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' }) + + cy.get('.ProseMirror pre') + .should('not.exist') }) it('should make a code block from markdown shortcuts', () => { diff --git a/docs/src/demos/Extensions/HardBreak/index.spec.js b/docs/src/demos/Extensions/HardBreak/index.spec.js index adb5a139..52936427 100644 --- a/docs/src/demos/Extensions/HardBreak/index.spec.js +++ b/docs/src/demos/Extensions/HardBreak/index.spec.js @@ -10,20 +10,35 @@ context('/api/extensions/hard-break', () => { }) it('the button should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror br').should('exist') + cy.get('.ProseMirror br') + .should('not.exist') + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror br') + .should('exist') }) it('the default keyboard shortcut should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, key: 'Enter' }) - cy.get('.ProseMirror br').should('exist') + cy.get('.ProseMirror br') + .should('not.exist') + + cy.get('.ProseMirror') + .trigger('keydown', { shiftKey: true, key: 'Enter' }) + + cy.get('.ProseMirror br') + .should('exist') }) it('the alternative keyboard shortcut should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'Enter' }) - cy.get('.ProseMirror br').should('exist') + cy.get('.ProseMirror br') + .should('not.exist') + + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'Enter' }) + + cy.get('.ProseMirror br') + .should('exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js index 2b174383..f78e415f 100644 --- a/docs/src/demos/Extensions/Heading/index.spec.js +++ b/docs/src/demos/Extensions/Heading/index.spec.js @@ -11,20 +11,38 @@ context('/api/extensions/heading', () => { }) it('the button should make the selected line a h1', () => { - cy.get('.ProseMirror h1').should('not.exist') - cy.get('.demo__preview button:nth-child(1)').click({ force: true }) - cy.get('.ProseMirror').find('h1').should('contain', 'Example Text') + cy.get('.ProseMirror h1') + .should('not.exist') + + cy.get('.demo__preview button:nth-child(1)') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('h1') + .should('contain', 'Example Text') }) it('the button should make the selected line a h2', () => { - cy.get('.ProseMirror h2').should('not.exist') - cy.get('.demo__preview button:nth-child(2)').click({ force: true }) - cy.get('.ProseMirror').find('h2').should('contain', 'Example Text') + cy.get('.ProseMirror h2') + .should('not.exist') + + cy.get('.demo__preview button:nth-child(2)') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('h2') + .should('contain', 'Example Text') }) it('the button should make the selected line a h3', () => { - cy.get('.ProseMirror h3').should('not.exist') - cy.get('.demo__preview button:nth-child(3)').click({ force: true }) - cy.get('.ProseMirror').find('h3').should('contain', 'Example Text') + cy.get('.ProseMirror h3') + .should('not.exist') + + cy.get('.demo__preview button:nth-child(3)') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('h3') + .should('contain', 'Example Text') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index 565d93cc..ea36f68c 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -10,29 +10,44 @@ context('/api/extensions/history', () => { }) it('should make the last change undone', () => { - cy.get('.ProseMirror').should('contain', 'Mistake') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') + cy.get('.ProseMirror') + .should('contain', 'Mistake') + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .should('not.contain', 'Mistake') }) it('the keyboard shortcut should make the last change undone', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'z' }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'z' }) + .should('not.contain', 'Mistake') }) it('should apply the last undone change again', () => { - cy.get('.ProseMirror').should('contain', 'Mistake') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') - cy.get('.demo__preview button:nth-child(2)').click({ force: true }) - cy.get('.ProseMirror').should('contain', 'Mistake') + cy.get('.ProseMirror') + .should('contain', 'Mistake') + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .should('not.contain', 'Mistake') + + cy.get('.demo__preview button:nth-child(2)') + .click({ force: true }) + + cy.get('.ProseMirror') + .should('contain', 'Mistake') }) it.skip('the keyboard shortcut should apply the last undone change again', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'z' }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') - - cy.get('.ProseMirror').trigger('keydown', { modKey: true, shiftKey: true, key: 'z' }) - cy.get('.ProseMirror').should('contain', 'Mistake') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'z' }) + .should('not.contain', 'Mistake') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'z' }) + .should('contain', 'Mistake') }) }) diff --git a/docs/src/demos/Extensions/HorizontalRule/index.spec.js b/docs/src/demos/Extensions/HorizontalRule/index.spec.js index 75b8f105..f925a8eb 100644 --- a/docs/src/demos/Extensions/HorizontalRule/index.spec.js +++ b/docs/src/demos/Extensions/HorizontalRule/index.spec.js @@ -10,18 +10,28 @@ context('/api/extensions/horizontal-rule', () => { }) it('the button should add a horizontal rule', () => { - cy.get('.ProseMirror hr').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror hr').should('exist') + cy.get('.ProseMirror hr') + .should('not.exist') + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror hr') + .should('exist') }) it('the default markdown shortcut should add a horizontal rule', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.clearContent() - cy.get('.ProseMirror hr').should('not.exist') - cy.get('.ProseMirror').type('---', { force: true }) - cy.get('.ProseMirror hr').should('exist') + cy.get('.ProseMirror hr') + .should('not.exist') + + cy.get('.ProseMirror') + .type('---', { force: true }) + + cy.get('.ProseMirror hr') + .should('exist') }) }) @@ -29,9 +39,14 @@ context('/api/extensions/horizontal-rule', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.clearContent() - cy.get('.ProseMirror hr').should('not.exist') - cy.get('.ProseMirror').type('___ ', { force: true }) - cy.get('.ProseMirror hr').should('exist') + cy.get('.ProseMirror hr') + .should('not.exist') + + cy.get('.ProseMirror') + .type('___ ', { force: true }) + + cy.get('.ProseMirror hr') + .should('exist') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Italic/index.spec.js b/docs/src/demos/Extensions/Italic/index.spec.js index 6b8db24e..f62f107f 100644 --- a/docs/src/demos/Extensions/Italic/index.spec.js +++ b/docs/src/demos/Extensions/Italic/index.spec.js @@ -11,25 +11,40 @@ context('/api/extensions/italic', () => { }) it('the button should make the selected text italic', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('em').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('em') + .should('contain', 'Example Text') }) it('the button should toggle the selected text italic', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror em').should('not.exist') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror em') + .should('not.exist') }) it('the keyboard shortcut should make the selected text italic', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'i' }) - cy.get('.ProseMirror').find('em').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'i' }) + .find('em') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text italic', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'i' }) - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'i' }) - cy.get('.ProseMirror em').should('not.exist') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'i' }) + .trigger('keydown', { modKey: true, key: 'i' }) + .find('em') + .should('not.exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index f541605c..32c4b00c 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -10,21 +10,36 @@ context('/api/extensions/paragraph', () => { }) it('text should be wrapped in a paragraph by default', () => { - cy.get('.ProseMirror').type('Example Text', { force: true }) - cy.get('.ProseMirror').find('p').should('contain', 'Example Text') + cy.get('.ProseMirror') + .type('Example Text', { force: true }) + .find('p') + .should('contain', 'Example Text') }) it('enter should make a new paragraph', () => { - cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true }) - cy.get('.ProseMirror').find('p').should('have.length', 2) - cy.get('.ProseMirror').find('p:first').should('contain', 'First Paragraph') - cy.get('.ProseMirror').find('p:nth-child(2)').should('contain', 'Second Paragraph') + cy.get('.ProseMirror') + .type('First Paragraph{enter}Second Paragraph', { force: true }) + .find('p') + .should('have.length', 2) + + cy.get('.ProseMirror') + .find('p:first') + .should('contain', 'First Paragraph') + + cy.get('.ProseMirror') + .find('p:nth-child(2)') + .should('contain', 'Second Paragraph') }) it('backspace should remove the second paragraph', () => { - cy.get('.ProseMirror').type('{enter}', { force: true }) - cy.get('.ProseMirror').find('p').should('have.length', 2) - cy.get('.ProseMirror').type('{backspace}', { force: true }) - cy.get('.ProseMirror').find('p').should('have.length', 1) + cy.get('.ProseMirror') + .type('{enter}', { force: true }) + .find('p') + .should('have.length', 2) + + cy.get('.ProseMirror') + .type('{backspace}', { force: true }) + .find('p') + .should('have.length', 1) }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js index d352ed9a..62a59e06 100644 --- a/docs/src/demos/Extensions/Strike/index.spec.js +++ b/docs/src/demos/Extensions/Strike/index.spec.js @@ -11,26 +11,42 @@ context('/api/extensions/strike', () => { }) it('the button should strike the selected text', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('s').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('s') + .should('contain', 'Example Text') }) it('the button should toggle the selected text striked', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror s').should('not.exist') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('s') + .should('not.exist') }) it('the keyboard shortcut should strike the selected text', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'd' }) - cy.get('.ProseMirror').find('s').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'd' }) + .find('s') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text striked', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'd' }) - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'd' }) - cy.get('.ProseMirror s').should('not.exist') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'd' }) + .trigger('keydown', { modKey: true, key: 'd' }) + .find('s') + .should('not.exist') }) it('should make a striked text from the markdown shortcut', () => { diff --git a/docs/src/demos/Extensions/Underline/index.spec.js b/docs/src/demos/Extensions/Underline/index.spec.js index 95c793d2..190c8468 100644 --- a/docs/src/demos/Extensions/Underline/index.spec.js +++ b/docs/src/demos/Extensions/Underline/index.spec.js @@ -11,25 +11,41 @@ context('/api/extensions/underline', () => { }) it('the button should underline the selected text', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').find('u').should('contain', 'Example Text') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('u') + .should('contain', 'Example Text') }) it('the button should toggle the selected text underline', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror u').should('not.exist') + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .type('{selectall}', { force: true }) + + cy.get('.demo__preview button:first') + .click({ force: true }) + + cy.get('.ProseMirror') + .find('u') + .should('not.exist') }) it('the keyboard shortcut should underline the selected text', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'u' }) - cy.get('.ProseMirror').find('u').should('contain', 'Example Text') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'u' }) + .find('u') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text underline', () => { - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'u' }) - cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'u' }) - cy.get('.ProseMirror u').should('not.exist') + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, key: 'u' }) + .trigger('keydown', { modKey: true, key: 'u' }) + .find('u') + .should('not.exist') }) }) \ No newline at end of file