replace all contains
This commit is contained in:
@@ -3,89 +3,101 @@ context('/examples/markdown-shortcuts', () => {
|
||||
cy.visit('/examples/markdown-shortcuts')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.focus()
|
||||
editor.clearContent()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should make a h1', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('# Headline', { force: true })
|
||||
.contains('h1', 'Headline')
|
||||
.find('h1')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should make a h2', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('## Headline', { force: true })
|
||||
.contains('h2', 'Headline')
|
||||
.find('h2')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should make a h3', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('### Headline', { force: true })
|
||||
.contains('h3', 'Headline')
|
||||
.find('h3')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should make a h4', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('#### Headline', { force: true })
|
||||
.contains('h4', 'Headline')
|
||||
.find('h4')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should make a h5', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('##### Headline', { force: true })
|
||||
.contains('h5', 'Headline')
|
||||
.find('h5')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should make a h6', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('###### Headline', { force: true })
|
||||
.contains('h6', 'Headline')
|
||||
.find('h6')
|
||||
.should('contain', 'Headline')
|
||||
})
|
||||
|
||||
it('should create inline code', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('`$foobar`', { force: true })
|
||||
.contains('code', '$foobar')
|
||||
.find('code')
|
||||
.should('contain', '$foobar')
|
||||
})
|
||||
|
||||
it.skip('should create a code block without language', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('``` {enter}const foo = bar{enter}```', { force: true })
|
||||
.contains('pre', 'const foo = bar')
|
||||
.find('pre')
|
||||
.should('contain', 'const foo = bar')
|
||||
})
|
||||
|
||||
it.skip('should create a bullet list from asteriks', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('* foobar', { force: true })
|
||||
.contains('ul', 'foobar')
|
||||
.find('ul')
|
||||
.should('contain', 'foobar')
|
||||
})
|
||||
|
||||
it.skip('should create a bullet list from dashes', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('- foobar', { force: true })
|
||||
.contains('ul', 'foobar')
|
||||
.find('ul')
|
||||
.should('contain', 'foobar')
|
||||
})
|
||||
|
||||
it.skip('should create a bullet list from pluses', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('+ foobar', { force: true })
|
||||
.contains('ul', 'foobar')
|
||||
.find('ul')
|
||||
.should('contain', 'foobar')
|
||||
})
|
||||
|
||||
it.skip('should create a ordered list', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('1. foobar', { force: true })
|
||||
.contains('ol', 'foobar')
|
||||
.find('ol')
|
||||
.should('contain', 'foobar')
|
||||
})
|
||||
|
||||
it.skip('should create a blockquote', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('> foobar', { force: true })
|
||||
.contains('blockquote', 'foobar')
|
||||
.find('blockquote')
|
||||
.should('contain', 'foobar')
|
||||
})
|
||||
})
|
||||
@@ -3,25 +3,24 @@ context('/api/extensions/blockquote', () => {
|
||||
cy.visit('/api/extensions/blockquote')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
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').contains('blockquote', 'Example Text')
|
||||
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').contains('blockquote', 'Example Text')
|
||||
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 })
|
||||
@@ -29,23 +28,24 @@ context('/api/extensions/blockquote', () => {
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected line a blockquote', () => {
|
||||
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 })
|
||||
cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the blockquote', () => {
|
||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 })
|
||||
cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text')
|
||||
|
||||
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 })
|
||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||
})
|
||||
|
||||
it('should make a blockquote from markdown shortcuts', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('> Quote', { force: true })
|
||||
.contains('blockquote', 'Quote')
|
||||
.find('blockquote')
|
||||
.should('contain', 'Quote')
|
||||
})
|
||||
})
|
||||
@@ -3,18 +3,17 @@ context('/api/extensions/bold', () => {
|
||||
cy.visit('/api/extensions/bold')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should make the selected text bold', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
||||
cy.get('.ProseMirror').find('strong').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text bold', () => {
|
||||
@@ -27,13 +26,15 @@ context('/api/extensions/bold', () => {
|
||||
it('the keyboard shortcut should make the selected text bold', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('{meta}b', { force: true })
|
||||
.contains('strong', 'Example Text')
|
||||
.find('strong')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text bold', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('{meta}b', { force: true })
|
||||
.contains('strong', 'Example Text')
|
||||
.find('strong')
|
||||
.should('contain', 'Example Text')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('{meta}b', { force: true })
|
||||
@@ -44,12 +45,14 @@ context('/api/extensions/bold', () => {
|
||||
it('should make a bold text from the default markdown shortcut', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('**Bold**', { force: true })
|
||||
.contains('strong', 'Bold')
|
||||
.find('strong')
|
||||
.should('contain', 'Bold')
|
||||
})
|
||||
|
||||
it('should make a bold text from the alternative markdown shortcut', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('__Bold__', { force: true })
|
||||
.contains('strong', 'Bold')
|
||||
.find('strong')
|
||||
.should('contain', 'Bold')
|
||||
})
|
||||
})
|
||||
@@ -3,18 +3,17 @@ context('/api/extensions/code', () => {
|
||||
cy.visit('/api/extensions/code')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should mark the selected text as inline code', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('code', 'Example Text')
|
||||
cy.get('.ProseMirror').find('code').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('should toggle the selected text as inline code', () => {
|
||||
|
||||
@@ -3,23 +3,22 @@ context('/api/extensions/code-block', () => {
|
||||
cy.visit('/api/extensions/code-block')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should make the selected line a code block', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||
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').contains('pre', 'Example Text')
|
||||
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 })
|
||||
@@ -27,22 +26,23 @@ context('/api/extensions/code-block', () => {
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected line a code block', () => {
|
||||
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 })
|
||||
cy.get('.ProseMirror').find('pre').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the code block', () => {
|
||||
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 })
|
||||
cy.get('.ProseMirror').find('pre').should('contain', 'Example Text')
|
||||
|
||||
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||
cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 })
|
||||
cy.get('.ProseMirror pre').should('not.exist')
|
||||
})
|
||||
|
||||
it('should make a code block from markdown shortcuts', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('``` {enter}Code', { force: true })
|
||||
.contains('pre', 'Code')
|
||||
.find('pre')
|
||||
.should('contain', 'Code')
|
||||
})
|
||||
})
|
||||
@@ -3,11 +3,10 @@ context('/api/extensions/hard-break', () => {
|
||||
cy.visit('/api/extensions/hard-break')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.focus()
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -3,30 +3,29 @@ context('/api/extensions/heading', () => {
|
||||
cy.visit('/api/extensions/heading')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
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').contains('h1', 'Example Text')
|
||||
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').contains('h2', 'Example Text')
|
||||
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').contains('h3', 'Example Text')
|
||||
cy.get('.ProseMirror').find('h3').should('contain', 'Example Text')
|
||||
})
|
||||
})
|
||||
@@ -3,16 +3,15 @@ context('/api/extensions/history', () => {
|
||||
cy.visit('/api/extensions/history')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.focus()
|
||||
editor.setContent('<p>Mistake</p>')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should make the last change undone', () => {
|
||||
cy.get('.ProseMirror').contains('Mistake')
|
||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||
})
|
||||
@@ -23,11 +22,11 @@ context('/api/extensions/history', () => {
|
||||
})
|
||||
|
||||
it('should apply the last undone change again', () => {
|
||||
cy.get('.ProseMirror').contains('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').contains('Mistake')
|
||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||
})
|
||||
|
||||
it.skip('the keyboard shortcut should apply the last undone change again', () => {
|
||||
@@ -35,6 +34,6 @@ context('/api/extensions/history', () => {
|
||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||
|
||||
cy.get('.ProseMirror').type('{meta}{shift}z', { force: true })
|
||||
cy.get('.ProseMirror').contains('Mistake')
|
||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,18 +3,17 @@ context('/api/extensions/italic', () => {
|
||||
cy.visit('/api/extensions/italic')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should make the selected text italic', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('em', 'Example Text')
|
||||
cy.get('.ProseMirror').find('em').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text italic', () => {
|
||||
@@ -26,7 +25,7 @@ context('/api/extensions/italic', () => {
|
||||
|
||||
it('the keyboard shortcut should make the selected text italic', () => {
|
||||
cy.get('.ProseMirror').type('{meta}i', { force: true })
|
||||
cy.get('.ProseMirror').contains('em', 'Example Text')
|
||||
cy.get('.ProseMirror').find('em').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text italic', () => {
|
||||
|
||||
@@ -3,11 +3,10 @@ context('/api/extensions/paragraph', () => {
|
||||
cy.visit('/api/extensions/paragraph')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.focus()
|
||||
editor.clearContent()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -3,18 +3,17 @@ context('/api/extensions/strike', () => {
|
||||
cy.visit('/api/extensions/strike')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should strike the selected text', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('s', 'Example Text')
|
||||
cy.get('.ProseMirror').find('s').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text striked', () => {
|
||||
@@ -26,7 +25,7 @@ context('/api/extensions/strike', () => {
|
||||
|
||||
it('the keyboard shortcut should strike the selected text', () => {
|
||||
cy.get('.ProseMirror').type('{meta}d', { force: true })
|
||||
cy.get('.ProseMirror').contains('s', 'Example Text')
|
||||
cy.get('.ProseMirror').find('s').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text striked', () => {
|
||||
@@ -37,6 +36,7 @@ context('/api/extensions/strike', () => {
|
||||
it('should make a striked text from the markdown shortcut', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('~Strike~', { force: true })
|
||||
.contains('s', 'Strike')
|
||||
.find('s')
|
||||
.should('contain', 'Strike')
|
||||
})
|
||||
})
|
||||
@@ -3,18 +3,17 @@ context('/api/extensions/underline', () => {
|
||||
cy.visit('/api/extensions/underline')
|
||||
})
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.focus()
|
||||
editor.selectAll()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should underline the selected text', () => {
|
||||
cy.get('.demo__preview button:first').click({ force: true })
|
||||
cy.get('.ProseMirror').contains('u', 'Example Text')
|
||||
cy.get('.ProseMirror').find('u').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text underline', () => {
|
||||
@@ -26,7 +25,7 @@ context('/api/extensions/underline', () => {
|
||||
|
||||
it('the keyboard shortcut should underline the selected text', () => {
|
||||
cy.get('.ProseMirror').type('{meta}u', { force: true })
|
||||
cy.get('.ProseMirror').contains('u', 'Example Text')
|
||||
cy.get('.ProseMirror').find('u').should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text underline', () => {
|
||||
|
||||
Reference in New Issue
Block a user