try to fix the test (wip)

This commit is contained in:
Hans Pagel
2020-10-27 22:38:05 +01:00
parent 65391c914a
commit 0f9c705ee0

View File

@@ -21,12 +21,12 @@ context('/api/extensions/highlight', () => {
it('should highlight the text in a specific color', () => { it('should highlight the text in a specific color', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.highlight({ color: 'rgb(255, 0, 0)' }) editor.highlight({ color: 'red' })
cy.get('.ProseMirror') cy.get('.ProseMirror')
.find('mark') .find('mark')
.should('contain', 'Example Text') .should('contain', 'Example Text')
.should('have.css', 'background-color', 'rgb(255, 0, 0)') .should('have.attr', 'data-color', 'red')
}) })
}) })
@@ -62,34 +62,34 @@ context('/api/extensions/highlight', () => {
}) })
}) })
it.only('is active for mark with any attributes', () => { it('is active for mark with any attributes', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><mark style="background-color: rgb(255, 0, 0);">Example Text</mark></p>') editor.setContent('<p><mark data-color="red">Example Text</mark></p>')
editor.selectAll() editor.selectAll()
expect(editor.isActive('highlight')).to.eq(1) expect(editor.isActive('highlight')).to.eq(true)
}) })
}) })
it.only('is active for mark with same attributes', () => { it('is active for mark with same attributes', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><mark style="background-color: rgb(255, 0, 0);">Example Text</mark></p>') editor.setContent('<p><mark style="background-color: rgb(255, 0, 0);">Example Text</mark></p>')
editor.selectAll() editor.selectAll()
expect(editor.isActive('highlight', { expect(editor.isActive('highlight', {
color: 'rgb(255, 0, 0)', color: 'rgb(255, 0, 0)',
})).to.eq(1) })).to.eq(true)
}) })
}) })
it.only('isnt active for mark with other attributes', () => { it('isnt active for mark with other attributes', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><mark style="background-color: rgb(255, 0, 0);">Example Text</mark></p>') editor.setContent('<p><mark style="background-color: rgb(255, 0, 0);">Example Text</mark></p>')
editor.selectAll() editor.selectAll()
expect(editor.isActive('highlight', { expect(editor.isActive('highlight', {
color: 'rgb(0, 0, 0)', color: 'rgb(0, 0, 0)',
})).to.eq(0) })).to.eq(false)
}) })
}) })