mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 16:44:49 -04:00
Improve tests (#944)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
e0e5f2a7dd
commit
3db6bcf892
20 changed files with 342 additions and 295 deletions
|
@ -13,22 +13,24 @@ describe('Code', () => {
|
|||
})
|
||||
cy.get('.btn.active.btn-outline-secondary > i.fa-columns')
|
||||
.should('exist')
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('{ctrl}a', { force: true })
|
||||
.type('{backspace}')
|
||||
|
||||
cy.get('.CodeMirror')
|
||||
.click()
|
||||
.get('textarea')
|
||||
.as('codeinput')
|
||||
})
|
||||
|
||||
describe('without = doesn\'t show gutter', () => {
|
||||
it('without wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript \nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript \nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
})
|
||||
|
||||
it('with wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript!\nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript!\nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
.should('have.class', 'wrapLines')
|
||||
|
@ -37,8 +39,8 @@ describe('Code', () => {
|
|||
|
||||
describe('with = shows gutter', () => {
|
||||
it('without wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript=\nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript=\nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
.should('have.class', 'showGutter')
|
||||
|
@ -48,8 +50,8 @@ describe('Code', () => {
|
|||
})
|
||||
|
||||
it('with wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript=! \nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript=! \nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
.should('have.class', 'showGutter')
|
||||
|
@ -62,8 +64,8 @@ describe('Code', () => {
|
|||
|
||||
describe('with = shows gutter and number is used as startline', () => {
|
||||
it('without wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript=100\nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript=100\nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
.should('have.class', 'showGutter')
|
||||
|
@ -73,8 +75,8 @@ describe('Code', () => {
|
|||
})
|
||||
|
||||
it('with wrapLines active', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript=100! \nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript=100! \nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > code')
|
||||
.should('have.class', 'hljs')
|
||||
.should('have.class', 'showGutter')
|
||||
|
@ -86,11 +88,11 @@ describe('Code', () => {
|
|||
})
|
||||
|
||||
it('has a button', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('```javascript \nlet x = 0\n```')
|
||||
cy.get('@codeinput')
|
||||
.fill('```javascript \nlet x = 0\n```')
|
||||
cy.get('.markdown-body > pre > div > button > i')
|
||||
.should('have.class', 'fa-files-o')
|
||||
.click()
|
||||
cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n');
|
||||
cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue