mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-23 20:03:19 +00:00
d725b65140
* Add cy.getById method and run prettier Signed-off-by: Erik Michelson <github@erik.michelson.eu>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
describe('The status bar text length info', () => {
|
|
const warningTestContent = '0123456789'.repeat(10)
|
|
const dangerTestContent = '0123456789'.repeat(20)
|
|
const tooMuchTestContent = `${dangerTestContent}a`
|
|
|
|
beforeEach(() => {
|
|
cy.visitTestEditor()
|
|
})
|
|
|
|
it('shows the maximal length of the document as number of available characters in the tooltip', () => {
|
|
cy.getById('remainingCharacters').attribute('title').should('contain', ' 200 ')
|
|
})
|
|
|
|
it('color is set to "warning" on <= 100 characters remaining', () => {
|
|
cy.setCodemirrorContent(warningTestContent)
|
|
cy.getById('remainingCharacters').should('have.class', 'text-warning')
|
|
})
|
|
|
|
it('color is set to danger on <= 0 characters remaining', () => {
|
|
cy.setCodemirrorContent(dangerTestContent)
|
|
cy.getById('remainingCharacters').should('have.class', 'text-danger')
|
|
})
|
|
|
|
it('shows a warning and opens a modal', () => {
|
|
cy.setCodemirrorContent(tooMuchTestContent)
|
|
cy.getById('limitReachedModal').should('be.visible')
|
|
cy.getIframeBody().findById('limitReachedMessage').should('be.visible')
|
|
})
|
|
})
|