test(examples): add tests for more example pages
This commit is contained in:
committed by
Dominik
parent
0532770170
commit
b7f95d638d
27
demos/src/Examples/Images/React/index.spec.js
Normal file
27
demos/src/Examples/Images/React/index.spec.js
Normal file
@@ -0,0 +1,27 @@
|
||||
context('/src/Examples/Images/React/', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/src/Examples/Images/React/')
|
||||
})
|
||||
|
||||
// TODO: Write tests
|
||||
it('finds image elements inside editor', () => {
|
||||
cy.get('.ProseMirror img').should('have.length', 2)
|
||||
})
|
||||
|
||||
it('allows removing images', () => {
|
||||
cy.get('.ProseMirror img').should('have.length', 2)
|
||||
cy.get('.ProseMirror img').first().trigger('mousedown', { which: 1 })
|
||||
cy.get('.ProseMirror').type('{backspace}')
|
||||
cy.get('.ProseMirror img').should('have.length', 1)
|
||||
})
|
||||
|
||||
it('allows images to be added via URL', () => {
|
||||
cy.window().then(win => {
|
||||
cy.stub(win, 'prompt').returns('https://unsplash.it/250/250')
|
||||
|
||||
cy.get('button').contains('add image from URL').click()
|
||||
cy.wait(1000)
|
||||
cy.get('.ProseMirror img').should('have.length', 3)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user