test(examples): add tests for more example pages

This commit is contained in:
Dominik Biedebach
2022-05-11 17:46:30 +02:00
committed by Dominik
parent 0532770170
commit b7f95d638d
15 changed files with 701 additions and 10 deletions

View File

@@ -0,0 +1,47 @@
context('/src/Examples/InteractivityComponentContent/React/', () => {
beforeEach(() => {
cy.visit('/src/Examples/InteractivityComponentContent/React/')
})
it('should have a working tiptap instance', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
// eslint-disable-next-line
expect(editor).to.not.be.null
})
})
it('should render a custom node', () => {
cy.get('.ProseMirror .react-component-with-content')
.should('have.length', 1)
})
it('should allow text editing inside component', () => {
cy.get('.ProseMirror .react-component-with-content .content div')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.type('Hello World!')
.should('have.text', 'Hello World!')
})
it('should allow text editing inside component with markdown text', () => {
cy.get('.ProseMirror .react-component-with-content .content div')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.type('Hello World! This is **bold**.')
.should('have.text', 'Hello World! This is bold.')
cy.get('.ProseMirror .react-component-with-content .content strong')
.should('exist')
})
it('should remove node via selectall', () => {
cy.get('.ProseMirror .react-component-with-content')
.should('have.length', 1)
cy.get('.ProseMirror')
.type('{selectall}{backspace}')
cy.get('.ProseMirror .react-component-with-content')
.should('have.length', 0)
})
})