made the addCodeFences function also work without selections (#428)

* made the addCodeFences function also work without selections
changed tests accordingly

* add codeFence change in CHANGELOG.md
This commit is contained in:
Philip Molares 2020-08-19 21:26:22 +02:00 committed by GitHub
parent 5a56784cd0
commit 13b7854c65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 17 deletions

View file

@ -85,18 +85,48 @@ describe('Toolbar', () => {
.should('have.text', `## ${testText}`)
})
it('code', () => {
cy.get('.CodeMirror textarea')
.type(`${testText}`)
.type('{ctrl}a')
cy.get('.fa-code')
.click()
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', '```')
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span')
.should('have.text', testText)
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span')
.should('have.text', '```')
describe('code', () => {
it('nothing selected empty line', () => {
cy.get('.CodeMirror textarea')
.type(`${testText}`)
.type('{ctrl}a')
.type('{backspace}')
cy.get('.fa-code')
.click()
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', '```')
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span')
.should('have.text', '```')
})
it('nothing selected non line', () => {
cy.get('.CodeMirror textarea')
.type(`${testText}`)
.type('{ctrl}a')
.type('{leftArrow}')
cy.get('.fa-code')
.click()
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', '```')
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span')
.should('have.text', testText)
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span')
.should('have.text', '```')
})
it('line selected', () => {
cy.get('.CodeMirror textarea')
.type(`${testText}`)
.type('{ctrl}a')
cy.get('.fa-code')
.click()
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
.should('have.text', '```')
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span span')
.should('have.text', testText)
cy.get('.CodeMirror-code > div.CodeMirror-activeline > .CodeMirror-line > span span')
.should('have.text', '```')
})
})
it('quote', () => {