store editor in dom element
This commit is contained in:
@@ -4,8 +4,7 @@ context('/api/extensions/blockquote', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/bold', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/code', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/code-block', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/hard-break', () => {
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/heading', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,19 +4,16 @@ context('/api/extensions/history', () => {
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Mistake</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should make the last change undone', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
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:first').click({ force: true })
|
||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the last change undone', () => {
|
||||
@@ -25,14 +22,12 @@ context('/api/extensions/history', () => {
|
||||
})
|
||||
|
||||
it('should apply the last undone change again', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
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')
|
||||
})
|
||||
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', () => {
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/horizontal-rule', () => {
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
@@ -17,8 +16,7 @@ context('/api/extensions/horizontal-rule', () => {
|
||||
})
|
||||
|
||||
it('the default markdown shortcut should add a horizontal rule', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
|
||||
cy.get('.ProseMirror hr').should('not.exist')
|
||||
@@ -28,8 +26,7 @@ context('/api/extensions/horizontal-rule', () => {
|
||||
})
|
||||
|
||||
it('the alternative markdown shortcut should add a horizontal rule', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
|
||||
cy.get('.ProseMirror hr').should('not.exist')
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/italic', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/paragraph', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/strike', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
@@ -4,8 +4,7 @@ context('/api/extensions/underline', () => {
|
||||
})
|
||||
|
||||
beforeEach((done) => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
done()
|
||||
|
||||
Reference in New Issue
Block a user