2021-05-04 14:34:16 -04:00
|
|
|
/*
|
2022-06-08 07:19:51 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2021-05-04 14:34:16 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
describe('Task lists ', () => {
|
|
|
|
beforeEach(() => {
|
2022-01-30 15:46:43 -05:00
|
|
|
cy.visitTestNote()
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('render with checkboxes ', () => {
|
|
|
|
it('when unchecked', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.setCodemirrorContent('- [ ] abc\n\n* [ ] abc\n\n+ [ ] abc\n\n1. [ ] abc\n\n10. [ ] abc\n\n5) [ ] abc')
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getMarkdownBody().find('input[type=checkbox]').should('have.length', 6)
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('when checked lowercase', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.setCodemirrorContent('- [x] abc\n\n* [x] abc\n\n+ [x] abc\n\n1. [x] abc\n\n10. [x] abc\n\n5) [x] abc')
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getMarkdownBody().find('input[type=checkbox]').should('have.length', 6)
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('when checked uppercase', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.setCodemirrorContent('- [X] abc\n\n* [X] abc\n\n+ [X] abc\n\n1. [X] abc\n\n10. [X] abc\n\n5) [X] abc')
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getMarkdownBody().find('input[type=checkbox]').should('have.length', 6)
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('do not render as checkboxes when invalid', () => {
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.setCodemirrorContent('- [Y] abc\n\n* [ ] abc\n\n+ [-] abc\n\n1. [.] abc\n\n10. [] abc\n\n5) [-] abc')
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getMarkdownBody().find('input[type=checkbox]').should('have.length', 0)
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|
|
|
|
|
2024-11-11 06:53:31 -05:00
|
|
|
// TODO Re-enable tests as soon as cypress error is fixed.
|
|
|
|
// These tests stopped working in cypress although manual testing works fine.
|
|
|
|
// https://github.com/hedgedoc/hedgedoc/issues/5863
|
2021-05-04 14:34:16 -04:00
|
|
|
|
2024-11-11 06:53:31 -05:00
|
|
|
// describe('are clickable and change the markdown source ', () => {
|
|
|
|
// it('from unchecked to checked', () => {
|
|
|
|
// cy.setCodemirrorContent('- [ ] abc')
|
|
|
|
// cy.getMarkdownBody()
|
|
|
|
// .find('input[type=checkbox]')
|
|
|
|
// .each((box) => {
|
|
|
|
// box.click()
|
|
|
|
// })
|
|
|
|
// cy.get('.cm-editor .cm-line').first().should('contain.text', '[x]').should('not.contain.text', '[ ]')
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// it('from checked (lowercase) to unchecked', () => {
|
|
|
|
// cy.setCodemirrorContent('- [x] abc')
|
|
|
|
// cy.getMarkdownBody()
|
|
|
|
// .find('input[type=checkbox]')
|
|
|
|
// .each((box) => {
|
|
|
|
// box.click()
|
|
|
|
// })
|
|
|
|
// cy.get('.cm-editor .cm-line').should('exist').should('contain.text', '[ ]').should('not.contain.text', '[x]')
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// it('from checked (uppercase) to unchecked', () => {
|
|
|
|
// cy.setCodemirrorContent('- [X] abc')
|
|
|
|
// cy.getMarkdownBody()
|
|
|
|
// .find('input[type=checkbox]')
|
|
|
|
// .each((box) => {
|
|
|
|
// box.click()
|
|
|
|
// })
|
|
|
|
// cy.get('.cm-editor .cm-line').should('exist').should('contain.text', '[ ]').should('not.contain.text', '[X]')
|
|
|
|
// })
|
|
|
|
// })
|
2021-05-04 14:34:16 -04:00
|
|
|
})
|