Add word count in document info modal (#738)

Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Erik Michelson 2021-06-17 22:31:28 +02:00 committed by GitHub
parent 4b3990d0db
commit 57f46f489b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 242 additions and 9 deletions

View file

@ -0,0 +1,43 @@
/*
* 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.codemirrorFill('')
cy.wait(500)
cy.get('[data-cy="sidebar-btn-document-info"]').click()
cy.get('[data-cy="document-info-modal"]').should('be.visible')
cy.get('[data-cy="document-info-word-count"]').should('have.text', '0')
})
it('simple words', () => {
cy.codemirrorFill('five words should be enough')
cy.wait(500)
cy.get('[data-cy="sidebar-btn-document-info"]').click()
cy.get('[data-cy="document-info-modal"]').should('be.visible')
cy.get('[data-cy="document-info-word-count"]').should('have.text', '5')
})
it('excluded codeblocks', () => {
cy.codemirrorFill('```\nthis is should be ignored\n```\n\ntwo `words`')
cy.wait(500)
cy.get('[data-cy="sidebar-btn-document-info"]').click()
cy.get('[data-cy="document-info-modal"]').should('be.visible')
cy.get('[data-cy="document-info-word-count"]').should('have.text', '2')
})
it('excluded images', () => {
cy.codemirrorFill('![ignored alt text](https://dummyimage.com/48) not ignored text')
cy.wait(500)
cy.get('[data-cy="sidebar-btn-document-info"]').click()
cy.get('[data-cy="document-info-modal"]').should('be.visible')
cy.get('[data-cy="document-info-word-count"]').should('have.text', '3')
})
})