2021-06-17 20:31:28 +00:00
|
|
|
/*
|
|
|
|
* 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', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('')
|
2021-06-17 20:31:28 +00:00
|
|
|
cy.wait(500)
|
2021-10-17 19:20:23 +00:00
|
|
|
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')
|
2021-06-17 20:31:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('simple words', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('five words should be enough')
|
2021-06-17 20:31:28 +00:00
|
|
|
cy.wait(500)
|
2021-10-17 19:20:23 +00:00
|
|
|
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')
|
2021-06-17 20:31:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('excluded codeblocks', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```\nthis is should be ignored\n```\n\ntwo `words`')
|
2021-06-17 20:31:28 +00:00
|
|
|
cy.wait(500)
|
2021-10-17 19:20:23 +00:00
|
|
|
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')
|
2021-06-17 20:31:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('excluded images', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('![ignored alt text](https://dummyimage.com/48) not ignored text')
|
2021-06-17 20:31:28 +00:00
|
|
|
cy.wait(500)
|
2021-10-17 19:20:23 +00:00
|
|
|
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')
|
2021-06-17 20:31:28 +00:00
|
|
|
})
|
|
|
|
})
|