Improve tests (#944)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2021-01-11 23:22:11 +01:00 committed by GitHub
parent e0e5f2a7dd
commit 3db6bcf892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 342 additions and 295 deletions

View file

@ -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')
})
})