async beforeeach

This commit is contained in:
Hans Pagel
2020-09-11 16:24:37 +02:00
parent 3e0e3b73e6
commit c4d02c291c
11 changed files with 32 additions and 26 deletions

View File

@@ -3,11 +3,11 @@ context('/examples/basic', () => {
cy.visit('/examples/basic') cy.visit('/examples/basic')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>foo</p>') editor.setContent('<p>foo</p>')
cy.wait(10) done()
}) })
}) })

View File

@@ -3,11 +3,11 @@ context('/examples/markdown-shortcuts', () => {
cy.visit('/examples/markdown-shortcuts') cy.visit('/examples/markdown-shortcuts')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.clearContent() editor.clearContent()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/blockquote', () => {
cy.visit('/api/extensions/blockquote') cy.visit('/api/extensions/blockquote')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/bold', () => {
cy.visit('/api/extensions/bold') cy.visit('/api/extensions/bold')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })
@@ -25,13 +25,19 @@ context('/api/extensions/bold', () => {
}) })
it('the keyboard shortcut should make the selected text bold', () => { it('the keyboard shortcut should make the selected text bold', () => {
cy.get('.ProseMirror').type('{meta}b', { force: true }) cy.get('.ProseMirror')
cy.get('.ProseMirror').contains('strong', 'Example Text') .type('{meta}b', { force: true })
.contains('strong', 'Example Text')
}) })
it('the keyboard shortcut should toggle the selected text bold', () => { it('the keyboard shortcut should toggle the selected text bold', () => {
cy.get('.ProseMirror').type('{meta}b', { force: true }).type('{meta}b', { force: true }) cy.get('.ProseMirror')
cy.get('.ProseMirror strong').should('not.exist') .type('{meta}b', { force: true })
.contains('strong', 'Example Text')
cy.get('.ProseMirror')
.type('{meta}b', { force: true })
.should('not.exist')
}) })
it('should make a bold text from the default markdown shortcut', () => { it('should make a bold text from the default markdown shortcut', () => {

View File

@@ -3,12 +3,12 @@ context('/api/extensions/code', () => {
cy.visit('/api/extensions/code') cy.visit('/api/extensions/code')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/code-block', () => {
cy.visit('/api/extensions/code-block') cy.visit('/api/extensions/code-block')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/heading', () => {
cy.visit('/api/extensions/heading') cy.visit('/api/extensions/heading')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/italic', () => {
cy.visit('/api/extensions/italic') cy.visit('/api/extensions/italic')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,11 +3,11 @@ context('/api/extensions/paragraph', () => {
cy.visit('/api/extensions/paragraph') cy.visit('/api/extensions/paragraph')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.clearContent() editor.clearContent()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/strike', () => {
cy.visit('/api/extensions/strike') cy.visit('/api/extensions/strike')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })

View File

@@ -3,12 +3,12 @@ context('/api/extensions/underline', () => {
cy.visit('/api/extensions/underline') cy.visit('/api/extensions/underline')
}) })
beforeEach(() => { beforeEach((done) => {
cy.get('.ProseMirror').window().then(window => { cy.get('.ProseMirror').window().then(window => {
const { editor } = window const { editor } = window
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
editor.selectAll() editor.selectAll()
cy.wait(10) done()
}) })
}) })