store editor in dom element

This commit is contained in:
Philipp Kühn
2020-09-11 18:06:13 +02:00
parent e0993a135a
commit 808b806db8
18 changed files with 45 additions and 58 deletions

View File

@@ -4,8 +4,7 @@ context('/examples/export-html-or-json', () => {
})
it('should return json', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
const json = editor.json()
expect(json).to.deep.equal({
@@ -52,8 +51,7 @@ context('/examples/export-html-or-json', () => {
})
it('should return html', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
expect(html).to.equal('<p>You are able to export your data as <code>HTML</code> or <code>JSON</code>.</p>')

View File

@@ -4,8 +4,7 @@ context('/examples/focus', () => {
})
it('should have class', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.focus('start')
cy.get('.ProseMirror p:first').should('have.class', 'has-focus')

View File

@@ -4,8 +4,7 @@ context('/examples/history', () => {
})
it('should not have a mistake', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
@@ -13,8 +12,7 @@ context('/examples/history', () => {
})
it('should have a mistake', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
editor.insertText('Mistake')
@@ -23,8 +21,7 @@ context('/examples/history', () => {
})
it('the mistake should be removed again', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
editor.undo()

View File

@@ -4,8 +4,7 @@ context('/examples/markdown-shortcuts', () => {
})
beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.clearContent()
done()
})

View File

@@ -4,10 +4,9 @@ context('/examples/read-only', () => {
})
it.skip('should be read-only', () => {
cy.get('.ProseMirror').window().then(window => {
cy.get('.ProseMirror').then(([{ editor }]) => {
cy.get('#editable').uncheck()
const { editor } = window
editor.insertText('Edited: ')
cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ')
@@ -15,10 +14,9 @@ context('/examples/read-only', () => {
})
it.skip('should be editable', () => {
cy.get('.ProseMirror').window().then(window => {
cy.get('.ProseMirror').then(([{ editor }]) => {
cy.get('#editable').check()
const { editor } = window
editor.insertText('Edited: ')
cy.get('.ProseMirror p:first').should('contain', 'Edited: ')