mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
docs: add tests for color picker demo
This commit is contained in:
parent
001c30b1f8
commit
96a7310b9d
@ -3,5 +3,51 @@ context('/demos/Extensions/Color', () => {
|
||||
cy.visit('/demos/Extensions/Color')
|
||||
})
|
||||
|
||||
// TODO: Write tests
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
})
|
||||
cy.get('.ProseMirror').type('{selectall}')
|
||||
})
|
||||
|
||||
it('should set the color of the selected text', () => {
|
||||
cy.get('button:first')
|
||||
.should('not.have.class', 'is-active')
|
||||
.click()
|
||||
.should('have.class', 'is-active')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.find('span')
|
||||
.should('have.attr', 'style', 'color: #958DF1')
|
||||
})
|
||||
|
||||
it('should remove the color of the selected text', () => {
|
||||
cy.get('button:first')
|
||||
.click()
|
||||
|
||||
cy.get('.ProseMirror span').should('exist')
|
||||
|
||||
cy.get('button:last')
|
||||
.click()
|
||||
|
||||
cy.get('.ProseMirror span').should('not.exist')
|
||||
})
|
||||
|
||||
it('should change text color with color picker', () => {
|
||||
cy.get('input[type=color]')
|
||||
.invoke('val', '#ff0000')
|
||||
.trigger('input')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.find('span')
|
||||
.should('have.attr', 'style', 'color: #ff0000')
|
||||
})
|
||||
|
||||
it('should match text and color picker color values', () => {
|
||||
cy.get('button:first')
|
||||
.click()
|
||||
|
||||
cy.get('input[type=color]')
|
||||
.should('have.value', '#958df1')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user