defaults to force: true for type and click
This commit is contained in:
@@ -11,91 +11,91 @@ context('/examples/markdown-shortcuts', () => {
|
|||||||
|
|
||||||
it('should make a h1', () => {
|
it('should make a h1', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('# Headline', { force: true })
|
.type('# Headline')
|
||||||
.find('h1')
|
.find('h1')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a h2', () => {
|
it('should make a h2', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('## Headline', { force: true })
|
.type('## Headline')
|
||||||
.find('h2')
|
.find('h2')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a h3', () => {
|
it('should make a h3', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('### Headline', { force: true })
|
.type('### Headline')
|
||||||
.find('h3')
|
.find('h3')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a h4', () => {
|
it('should make a h4', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('#### Headline', { force: true })
|
.type('#### Headline')
|
||||||
.find('h4')
|
.find('h4')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a h5', () => {
|
it('should make a h5', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('##### Headline', { force: true })
|
.type('##### Headline')
|
||||||
.find('h5')
|
.find('h5')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a h6', () => {
|
it('should make a h6', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('###### Headline', { force: true })
|
.type('###### Headline')
|
||||||
.find('h6')
|
.find('h6')
|
||||||
.should('contain', 'Headline')
|
.should('contain', 'Headline')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create inline code', () => {
|
it('should create inline code', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('`$foobar`', { force: true })
|
.type('`$foobar`')
|
||||||
.find('code')
|
.find('code')
|
||||||
.should('contain', '$foobar')
|
.should('contain', '$foobar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a code block without language', () => {
|
it.skip('should create a code block without language', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('``` {enter}const foo = bar{enter}```', { force: true })
|
.type('``` {enter}const foo = bar{enter}```')
|
||||||
.find('pre')
|
.find('pre')
|
||||||
.should('contain', 'const foo = bar')
|
.should('contain', 'const foo = bar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a bullet list from asteriks', () => {
|
it.skip('should create a bullet list from asteriks', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('* foobar', { force: true })
|
.type('* foobar')
|
||||||
.find('ul')
|
.find('ul')
|
||||||
.should('contain', 'foobar')
|
.should('contain', 'foobar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a bullet list from dashes', () => {
|
it.skip('should create a bullet list from dashes', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('- foobar', { force: true })
|
.type('- foobar')
|
||||||
.find('ul')
|
.find('ul')
|
||||||
.should('contain', 'foobar')
|
.should('contain', 'foobar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a bullet list from pluses', () => {
|
it.skip('should create a bullet list from pluses', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('+ foobar', { force: true })
|
.type('+ foobar')
|
||||||
.find('ul')
|
.find('ul')
|
||||||
.should('contain', 'foobar')
|
.should('contain', 'foobar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a ordered list', () => {
|
it.skip('should create a ordered list', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('1. foobar', { force: true })
|
.type('1. foobar')
|
||||||
.find('ol')
|
.find('ol')
|
||||||
.should('contain', 'foobar')
|
.should('contain', 'foobar')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should create a blockquote', () => {
|
it.skip('should create a blockquote', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('> foobar', { force: true })
|
.type('> foobar')
|
||||||
.find('blockquote')
|
.find('blockquote')
|
||||||
.should('contain', 'foobar')
|
.should('contain', 'foobar')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ context('/api/extensions/blockquote', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('blockquote')
|
.find('blockquote')
|
||||||
@@ -27,17 +27,17 @@ context('/api/extensions/blockquote', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('blockquote')
|
.find('blockquote')
|
||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror blockquote')
|
cy.get('.ProseMirror blockquote')
|
||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
@@ -60,7 +60,7 @@ context('/api/extensions/blockquote', () => {
|
|||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
.trigger('keydown', { shiftKey: true, modKey: true, key: '9' })
|
.trigger('keydown', { shiftKey: true, modKey: true, key: '9' })
|
||||||
|
|
||||||
cy.get('.ProseMirror blockquote')
|
cy.get('.ProseMirror blockquote')
|
||||||
@@ -69,7 +69,7 @@ context('/api/extensions/blockquote', () => {
|
|||||||
|
|
||||||
it('should make a blockquote from markdown shortcuts', () => {
|
it('should make a blockquote from markdown shortcuts', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('> Quote', { force: true })
|
.type('> Quote')
|
||||||
.find('blockquote')
|
.find('blockquote')
|
||||||
.should('contain', 'Quote')
|
.should('contain', 'Quote')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,16 +11,18 @@ context('/api/extensions/bold', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('the button should make the selected text bold', () => {
|
it('the button should make the selected text bold', () => {
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first')
|
||||||
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('strong')
|
.find('strong')
|
||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the button should toggle the selected text bold', () => {
|
it('the button should toggle the selected text bold', () => {
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click()
|
||||||
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
cy.get('.ProseMirror').type('{selectall}')
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click()
|
||||||
cy.get('.ProseMirror strong').should('not.exist')
|
cy.get('.ProseMirror strong').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -45,14 +47,14 @@ context('/api/extensions/bold', () => {
|
|||||||
|
|
||||||
it('should make a bold text from the default markdown shortcut', () => {
|
it('should make a bold text from the default markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('**Bold**', { force: true })
|
.type('**Bold**')
|
||||||
.find('strong')
|
.find('strong')
|
||||||
.should('contain', 'Bold')
|
.should('contain', 'Bold')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a bold text from the alternative markdown shortcut', () => {
|
it('should make a bold text from the alternative markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('__Bold__', { force: true })
|
.type('__Bold__')
|
||||||
.find('strong')
|
.find('strong')
|
||||||
.should('contain', 'Bold')
|
.should('contain', 'Bold')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ context('/api/extensions/code', () => {
|
|||||||
|
|
||||||
it('should mark the selected text as inline code', () => {
|
it('should mark the selected text as inline code', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('code')
|
.find('code')
|
||||||
@@ -21,13 +21,13 @@ context('/api/extensions/code', () => {
|
|||||||
|
|
||||||
it('should toggle the selected text as inline code', () => {
|
it('should toggle the selected text as inline code', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror code')
|
cy.get('.ProseMirror code')
|
||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ context('/api/extensions/code-block', () => {
|
|||||||
|
|
||||||
it('the button should make the selected line a code block', () => {
|
it('the button should make the selected line a code block', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('pre')
|
.find('pre')
|
||||||
@@ -21,17 +21,17 @@ context('/api/extensions/code-block', () => {
|
|||||||
|
|
||||||
it('the button should toggle the code block', () => {
|
it('the button should toggle the code block', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('pre')
|
.find('pre')
|
||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror pre')
|
cy.get('.ProseMirror pre')
|
||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
@@ -51,7 +51,7 @@ context('/api/extensions/code-block', () => {
|
|||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
.trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' })
|
.trigger('keydown', { shiftKey: true, ctrlKey: true, key: '\\' })
|
||||||
|
|
||||||
cy.get('.ProseMirror pre')
|
cy.get('.ProseMirror pre')
|
||||||
@@ -60,7 +60,7 @@ context('/api/extensions/code-block', () => {
|
|||||||
|
|
||||||
it('should make a code block from markdown shortcuts', () => {
|
it('should make a code block from markdown shortcuts', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('``` {enter}Code', { force: true })
|
.type('``` {enter}Code')
|
||||||
.find('pre')
|
.find('pre')
|
||||||
.should('contain', 'Code')
|
.should('contain', 'Code')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ context('/api/extensions/hard-break', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror br')
|
cy.get('.ProseMirror br')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ context('/api/extensions/heading', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:nth-child(1)')
|
cy.get('.demo__preview button:nth-child(1)')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('h1')
|
.find('h1')
|
||||||
@@ -27,7 +27,7 @@ context('/api/extensions/heading', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:nth-child(2)')
|
cy.get('.demo__preview button:nth-child(2)')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('h2')
|
.find('h2')
|
||||||
@@ -39,7 +39,7 @@ context('/api/extensions/heading', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:nth-child(3)')
|
cy.get('.demo__preview button:nth-child(3)')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('h3')
|
.find('h3')
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ context('/api/extensions/history', () => {
|
|||||||
.should('contain', 'Mistake')
|
.should('contain', 'Mistake')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.should('not.contain', 'Mistake')
|
.should('not.contain', 'Mistake')
|
||||||
@@ -31,13 +31,13 @@ context('/api/extensions/history', () => {
|
|||||||
.should('contain', 'Mistake')
|
.should('contain', 'Mistake')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.should('not.contain', 'Mistake')
|
.should('not.contain', 'Mistake')
|
||||||
|
|
||||||
cy.get('.demo__preview button:nth-child(2)')
|
cy.get('.demo__preview button:nth-child(2)')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.should('contain', 'Mistake')
|
.should('contain', 'Mistake')
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ context('/api/extensions/horizontal-rule', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror hr')
|
cy.get('.ProseMirror hr')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@@ -28,7 +28,7 @@ context('/api/extensions/horizontal-rule', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('---', { force: true })
|
.type('---')
|
||||||
|
|
||||||
cy.get('.ProseMirror hr')
|
cy.get('.ProseMirror hr')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@@ -43,7 +43,7 @@ context('/api/extensions/horizontal-rule', () => {
|
|||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('___ ', { force: true })
|
.type('___ ')
|
||||||
|
|
||||||
cy.get('.ProseMirror hr')
|
cy.get('.ProseMirror hr')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ context('/api/extensions/italic', () => {
|
|||||||
|
|
||||||
it('the button should make the selected text italic', () => {
|
it('the button should make the selected text italic', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('em')
|
.find('em')
|
||||||
@@ -21,13 +21,13 @@ context('/api/extensions/italic', () => {
|
|||||||
|
|
||||||
it('the button should toggle the selected text italic', () => {
|
it('the button should toggle the selected text italic', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror em')
|
cy.get('.ProseMirror em')
|
||||||
.should('not.exist')
|
.should('not.exist')
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ context('/api/extensions/paragraph', () => {
|
|||||||
|
|
||||||
it('text should be wrapped in a paragraph by default', () => {
|
it('text should be wrapped in a paragraph by default', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('Example Text', { force: true })
|
.type('Example Text')
|
||||||
.find('p')
|
.find('p')
|
||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('enter should make a new paragraph', () => {
|
it('enter should make a new paragraph', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('First Paragraph{enter}Second Paragraph', { force: true })
|
.type('First Paragraph{enter}Second Paragraph')
|
||||||
.find('p')
|
.find('p')
|
||||||
.should('have.length', 2)
|
.should('have.length', 2)
|
||||||
|
|
||||||
@@ -33,12 +33,12 @@ context('/api/extensions/paragraph', () => {
|
|||||||
|
|
||||||
it('backspace should remove the second paragraph', () => {
|
it('backspace should remove the second paragraph', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{enter}', { force: true })
|
.type('{enter}')
|
||||||
.find('p')
|
.find('p')
|
||||||
.should('have.length', 2)
|
.should('have.length', 2)
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{backspace}', { force: true })
|
.type('{backspace}')
|
||||||
.find('p')
|
.find('p')
|
||||||
.should('have.length', 1)
|
.should('have.length', 1)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ context('/api/extensions/strike', () => {
|
|||||||
|
|
||||||
it('the button should strike the selected text', () => {
|
it('the button should strike the selected text', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('s')
|
.find('s')
|
||||||
@@ -21,13 +21,13 @@ context('/api/extensions/strike', () => {
|
|||||||
|
|
||||||
it('the button should toggle the selected text striked', () => {
|
it('the button should toggle the selected text striked', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('s')
|
.find('s')
|
||||||
@@ -51,7 +51,7 @@ context('/api/extensions/strike', () => {
|
|||||||
|
|
||||||
it('should make a striked text from the markdown shortcut', () => {
|
it('should make a striked text from the markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('~Strike~', { force: true })
|
.type('~Strike~')
|
||||||
.find('s')
|
.find('s')
|
||||||
.should('contain', 'Strike')
|
.should('contain', 'Strike')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ context('/api/extensions/underline', () => {
|
|||||||
|
|
||||||
it('the button should underline the selected text', () => {
|
it('the button should underline the selected text', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('u')
|
.find('u')
|
||||||
@@ -21,13 +21,13 @@ context('/api/extensions/underline', () => {
|
|||||||
|
|
||||||
it('the button should toggle the selected text underline', () => {
|
it('the button should toggle the selected text underline', () => {
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('{selectall}', { force: true })
|
.type('{selectall}')
|
||||||
|
|
||||||
cy.get('.demo__preview button:first')
|
cy.get('.demo__preview button:first')
|
||||||
.click({ force: true })
|
.click()
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.find('u')
|
.find('u')
|
||||||
|
|||||||
@@ -24,6 +24,23 @@
|
|||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
|
function defaults(object, name, value) {
|
||||||
|
if (!object) {
|
||||||
|
return {
|
||||||
|
[name]: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (object[name] === undefined) {
|
||||||
|
return {
|
||||||
|
...object,
|
||||||
|
[name]: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return object
|
||||||
|
}
|
||||||
|
|
||||||
Cypress.Commands.overwrite('trigger', (originalFn, element, text, options) => {
|
Cypress.Commands.overwrite('trigger', (originalFn, element, text, options) => {
|
||||||
if (text === 'keydown') {
|
if (text === 'keydown') {
|
||||||
const isMac = Cypress.platform === 'darwin'
|
const isMac = Cypress.platform === 'darwin'
|
||||||
@@ -31,7 +48,7 @@ Cypress.Commands.overwrite('trigger', (originalFn, element, text, options) => {
|
|||||||
|
|
||||||
if (modKey) {
|
if (modKey) {
|
||||||
const newOptions = {
|
const newOptions = {
|
||||||
...rest,
|
...defaults(rest, 'force', true),
|
||||||
...(isMac ? { metaKey: modKey } : { ctrlKey: modKey }),
|
...(isMac ? { metaKey: modKey } : { ctrlKey: modKey }),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,4 +57,16 @@ Cypress.Commands.overwrite('trigger', (originalFn, element, text, options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return originalFn(element, text, options)
|
return originalFn(element, text, options)
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.overwrite('type', (originalFn, element, text, options) => {
|
||||||
|
const newOptions = defaults(options, 'force', true)
|
||||||
|
|
||||||
|
return originalFn(element, text, newOptions)
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.overwrite('click', (originalFn, element, text, options) => {
|
||||||
|
const newOptions = defaults(options, 'force', true)
|
||||||
|
|
||||||
|
return originalFn(element, text, newOptions)
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user