context('/src/Nodes/HorizontalRule/React/', () => {
before(() => {
cy.visit('/src/Nodes/HorizontalRule/React/')
})
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('
Example Text
')
})
})
it('should parse horizontal rules correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('Example Text
')
expect(editor.getHTML()).to.eq('Example Text
')
})
})
it('should parse horizontal rules with self-closing tag correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('Example Text
')
expect(editor.getHTML()).to.eq('Example Text
')
})
})
it('the button should add a horizontal rule', () => {
cy.get('.ProseMirror hr').should('not.exist')
cy.get('button:first').click()
cy.get('.ProseMirror hr').should('exist')
})
it('the default markdown shortcut should add a horizontal rule', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.ProseMirror hr').should('not.exist')
cy.get('.ProseMirror').type('---')
cy.get('.ProseMirror hr').should('exist')
})
})
it('the alternative markdown shortcut should add a horizontal rule', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.clearContent()
cy.get('.ProseMirror hr').should('not.exist')
cy.get('.ProseMirror').type('___ ')
cy.get('.ProseMirror hr').should('exist')
})
})
})