test(examples): add tests for more example pages
This commit is contained in:
committed by
Dominik
parent
0532770170
commit
b7f95d638d
38
demos/src/Examples/Formatting/React/index.spec.js
Normal file
38
demos/src/Examples/Formatting/React/index.spec.js
Normal file
@@ -0,0 +1,38 @@
|
||||
context('/src/Examples/Formatting/React/', () => {
|
||||
before(() => {
|
||||
cy.visit('/src/Examples/Formatting/React/')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').type('{selectall}{backspace}')
|
||||
})
|
||||
|
||||
const marks = [
|
||||
{ label: 'highlight', mark: 'mark' },
|
||||
]
|
||||
|
||||
marks.forEach(m => {
|
||||
it(`sets ${m.label}`, () => {
|
||||
cy.get('.ProseMirror').type('Hello world.{selectall}')
|
||||
cy.get('button').contains(m.label).click()
|
||||
cy.get('.ProseMirror mark').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
const alignments = [
|
||||
{ label: 'left', alignment: 'left' },
|
||||
{ label: 'center', alignment: 'center' },
|
||||
{ label: 'right', alignment: 'right' },
|
||||
{ label: 'justify', alignment: 'justify' },
|
||||
]
|
||||
|
||||
alignments.forEach(a => {
|
||||
it(`sets ${a.label}`, () => {
|
||||
cy.get('.ProseMirror').type('Hello world.{selectall}')
|
||||
cy.get('button').contains(a.label).click()
|
||||
if (a.alignment !== 'left') {
|
||||
cy.get('.ProseMirror p').should('have.css', 'text-align', a.alignment)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -3,5 +3,36 @@ context('/src/Examples/Formatting/Vue/', () => {
|
||||
cy.visit('/src/Examples/Formatting/Vue/')
|
||||
})
|
||||
|
||||
// TODO: Write tests
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').type('{selectall}{backspace}')
|
||||
})
|
||||
|
||||
const marks = [
|
||||
{ label: 'highlight', mark: 'mark' },
|
||||
]
|
||||
|
||||
marks.forEach(m => {
|
||||
it(`sets ${m.label}`, () => {
|
||||
cy.get('.ProseMirror').type('Hello world.{selectall}')
|
||||
cy.get('button').contains(m.label).click()
|
||||
cy.get('.ProseMirror mark').should('exist')
|
||||
})
|
||||
})
|
||||
|
||||
const alignments = [
|
||||
{ label: 'left', alignment: 'left' },
|
||||
{ label: 'center', alignment: 'center' },
|
||||
{ label: 'right', alignment: 'right' },
|
||||
{ label: 'justify', alignment: 'justify' },
|
||||
]
|
||||
|
||||
alignments.forEach(a => {
|
||||
it(`sets ${a.label}`, () => {
|
||||
cy.get('.ProseMirror').type('Hello world.{selectall}')
|
||||
cy.get('button').contains(a.label).click()
|
||||
if (a.alignment !== 'left') {
|
||||
cy.get('.ProseMirror p').should('have.css', 'text-align', a.alignment)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user