2020-09-09 22:12:39 +08:00
|
|
|
context('/api/extensions/paragraph', () => {
|
2020-09-11 23:51:57 +08:00
|
|
|
before(() => {
|
2020-09-09 22:12:39 +08:00
|
|
|
cy.visit('/api/extensions/paragraph')
|
2020-09-11 23:51:57 +08:00
|
|
|
})
|
2020-09-11 18:12:15 +08:00
|
|
|
|
2020-09-12 03:56:08 +08:00
|
|
|
beforeEach(() => {
|
2020-09-12 00:06:13 +08:00
|
|
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
2020-09-11 18:12:15 +08:00
|
|
|
editor.clearContent()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-09-11 21:57:33 +08:00
|
|
|
it('text should be wrapped in a paragraph by default', () => {
|
2020-09-15 06:07:00 +08:00
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.type('Example Text', { force: true })
|
|
|
|
.find('p')
|
|
|
|
.should('contain', 'Example Text')
|
2020-09-11 21:57:33 +08:00
|
|
|
})
|
2020-09-11 18:12:15 +08:00
|
|
|
|
2020-09-11 21:57:33 +08:00
|
|
|
it('enter should make a new paragraph', () => {
|
2020-09-15 06:07:00 +08:00
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.type('First Paragraph{enter}Second Paragraph', { force: true })
|
|
|
|
.find('p')
|
|
|
|
.should('have.length', 2)
|
|
|
|
|
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.find('p:first')
|
|
|
|
.should('contain', 'First Paragraph')
|
|
|
|
|
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.find('p:nth-child(2)')
|
|
|
|
.should('contain', 'Second Paragraph')
|
2020-09-11 21:57:33 +08:00
|
|
|
})
|
2020-09-11 18:12:15 +08:00
|
|
|
|
2020-09-11 21:57:33 +08:00
|
|
|
it('backspace should remove the second paragraph', () => {
|
2020-09-15 06:07:00 +08:00
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.type('{enter}', { force: true })
|
|
|
|
.find('p')
|
|
|
|
.should('have.length', 2)
|
|
|
|
|
|
|
|
cy.get('.ProseMirror')
|
|
|
|
.type('{backspace}', { force: true })
|
|
|
|
.find('p')
|
|
|
|
.should('have.length', 1)
|
2020-09-09 22:12:39 +08:00
|
|
|
})
|
|
|
|
})
|