mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-26 17:11:03 +00:00
a398660c18
* Add function for test attribute Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Adjust components Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Fix naming of attribute Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Rename method Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Rename method, interface, attribute and use interface Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Lint and format fix Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
describe('Test word count with', () => {
|
|
beforeEach(() => {
|
|
cy.visitTestEditor()
|
|
})
|
|
|
|
it('empty note', () => {
|
|
cy.setCodemirrorContent('')
|
|
cy.wait(500)
|
|
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
|
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
|
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '0')
|
|
})
|
|
|
|
it('simple words', () => {
|
|
cy.setCodemirrorContent('five words should be enough')
|
|
cy.wait(500)
|
|
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
|
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
|
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '5')
|
|
})
|
|
|
|
it('excluded codeblocks', () => {
|
|
cy.setCodemirrorContent('```\nthis is should be ignored\n```\n\ntwo `words`')
|
|
cy.wait(500)
|
|
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
|
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
|
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '2')
|
|
})
|
|
|
|
it('excluded images', () => {
|
|
cy.setCodemirrorContent('![ignored alt text](https://dummyimage.com/48) not ignored text')
|
|
cy.wait(500)
|
|
cy.get('[data-cypress-id="sidebar-btn-document-info"]').click()
|
|
cy.get('[data-cypress-id="document-info-modal"]').should('be.visible')
|
|
cy.get('[data-cypress-id="document-info-word-count"]').should('have.text', '3')
|
|
})
|
|
})
|