1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-19 14:44:39 +01:00

added cypress test for check-list page (#4383)

* added cypress test for check-list page

* Update cypress/integration/checkLists.ts

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* Update cypress/integration/checkLists.ts

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* Update cypress/integration/checkLists.ts

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* Added beforeEach() call

* moved the checkLists.ts example to the examples folder

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
This commit is contained in:
Anish Aggarwal 2021-08-02 23:49:10 +05:30 committed by GitHub
parent baa43c3f2e
commit a35fe46bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
describe('Check-lists example', () => {
beforeEach(() => {
cy.visit('examples/check-lists')
})
it('checks the bullet when clicked', () => {
const slateNodeElement = 'div[data-slate-node="element"]'
cy.get(slateNodeElement).should('have.length', 6)
cy.get(slateNodeElement)
.eq(3)
.should('contain', 'Criss-cross!')
.find('span')
.eq(1)
.should('have.css', 'text-decoration-line', 'line-through')
// Unchecking the checkboxes should un-cross the corresponding text.
cy.get(slateNodeElement)
.eq(3)
.should('contain', 'Criss-cross!')
.find('span')
.eq(0)
.find('input')
.uncheck()
.get(slateNodeElement)
.eq(3)
.should('contain', 'Criss-cross!')
.find('span')
.eq(1)
.should('have.css', 'text-decoration-line', 'none')
cy.get('p[data-slate-node="element"]').should('have.length', 2)
})
})

View File

@ -176,7 +176,7 @@ const CheckListItemElement = ({ attributes, children, element }) => {
className={css`
flex: 1;
opacity: ${checked ? 0.666 : 1};
text-decoration: ${checked ? 'none' : 'line-through'};
text-decoration: ${!checked ? 'none' : 'line-through'};
&:focus {
outline: none;