2020-08-14 07:58:59 -04:00
|
|
|
describe('Autocompletion', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/n/test')
|
|
|
|
cy.get('.btn.active.btn-outline-secondary > i.fa-columns')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{ctrl}a', { force: true })
|
|
|
|
.type('{backspace}')
|
|
|
|
})
|
|
|
|
|
2020-09-01 16:28:08 -04:00
|
|
|
describe('code block', () => {
|
2020-08-14 07:58:59 -04:00
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-09-01 16:28:08 -04:00
|
|
|
.type('```')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
|
|
|
.should('have.text', '```1c')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
|
|
|
|
.should('have.text', '```')
|
|
|
|
cy.get('.markdown-body > pre > code')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('```')
|
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
|
|
|
.should('have.text', '```1c')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
|
|
|
|
.should('have.text', '```')
|
|
|
|
cy.get('.markdown-body > pre > code')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('container', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type(':::')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
|
|
|
.should('have.text', ':::success')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
|
|
|
|
.should('have.text', ':::')
|
|
|
|
cy.get('.markdown-body > div.alert')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type(':::')
|
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
|
|
|
.should('have.text', ':::success')
|
|
|
|
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
|
|
|
|
.should('have.text', ':::')
|
|
|
|
cy.get('.markdown-body > div.alert')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('emoji', () => {
|
|
|
|
describe('normal emoji', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-10-10 17:12:17 -04:00
|
|
|
.type(':hedg')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-10-10 17:12:17 -04:00
|
|
|
.should('have.text', ':hedgehog:')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.markdown-body')
|
2020-10-10 17:12:17 -04:00
|
|
|
.should('have.text', '🦔')
|
2020-09-01 16:28:08 -04:00
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-10-10 17:12:17 -04:00
|
|
|
.type(':hedg')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-10-10 17:12:17 -04:00
|
|
|
.should('have.text', ':hedgehog:')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.markdown-body')
|
2020-10-10 17:12:17 -04:00
|
|
|
.should('have.text', '🦔')
|
2020-09-01 16:28:08 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('fork-awesome-icon', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-10-10 17:12:17 -04:00
|
|
|
.type(':fa-face')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', ':fa-facebook:')
|
|
|
|
cy.get('.markdown-body > p > i.fa.fa-facebook')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-10-10 17:12:17 -04:00
|
|
|
.type(':fa-face')
|
2020-09-01 16:28:08 -04:00
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', ':fa-facebook:')
|
|
|
|
cy.get('.markdown-body > p > i.fa.fa-facebook')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('header', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('#')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '# ')
|
|
|
|
cy.get('.markdown-body > h1 ')
|
|
|
|
.should('have.text', ' ')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('#')
|
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '# ')
|
|
|
|
cy.get('.markdown-body > h1')
|
|
|
|
.should('have.text', ' ')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('images', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('!')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-08-14 07:58:59 -04:00
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-09-01 16:28:08 -04:00
|
|
|
.should('have.text', '![image alt](https:// "title")')
|
|
|
|
cy.get('.markdown-body > p > img')
|
|
|
|
.should('have.attr', 'alt', 'image alt')
|
|
|
|
.should('have.attr', 'src', 'https://')
|
|
|
|
.should('have.attr', 'title', 'title')
|
2020-08-14 07:58:59 -04:00
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-09-01 16:28:08 -04:00
|
|
|
.type('!')
|
2020-08-14 07:58:59 -04:00
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-09-01 16:28:08 -04:00
|
|
|
.should('have.text', '![image alt](https:// "title")')
|
|
|
|
cy.get('.markdown-body > p > img')
|
|
|
|
.should('have.attr', 'alt', 'image alt')
|
|
|
|
.should('have.attr', 'src', 'https://')
|
|
|
|
.should('have.attr', 'title', 'title')
|
2020-08-14 07:58:59 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-09-01 16:28:08 -04:00
|
|
|
describe('links', () => {
|
2020-08-14 07:58:59 -04:00
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-09-01 16:28:08 -04:00
|
|
|
.type('[')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '[link text](https:// "title") ')
|
|
|
|
cy.get('.markdown-body > p > a')
|
|
|
|
.should('have.text', 'link text')
|
|
|
|
.should('have.attr', 'href', 'https://')
|
|
|
|
.should('have.attr', 'title', 'title')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('[')
|
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '[link text](https:// "title") ')
|
|
|
|
cy.get('.markdown-body > p > a')
|
|
|
|
.should('have.text', 'link text')
|
|
|
|
.should('have.attr', 'href', 'https://')
|
|
|
|
.should('have.attr', 'title', 'title')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('pdf', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-08-14 07:58:59 -04:00
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-09-01 16:28:08 -04:00
|
|
|
.should('have.text', '{%pdf https:// %}')
|
|
|
|
cy.get('.markdown-body > p')
|
2020-08-14 07:58:59 -04:00
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
2020-09-01 16:28:08 -04:00
|
|
|
.type('{')
|
2020-08-14 07:58:59 -04:00
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
2020-09-01 16:28:08 -04:00
|
|
|
.should('have.text', '{%pdf https:// %}')
|
|
|
|
cy.get('.markdown-body > p')
|
2020-08-14 07:58:59 -04:00
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
})
|
2020-09-30 17:35:10 -04:00
|
|
|
|
|
|
|
describe('collapsable blocks', () => {
|
|
|
|
it('via Enter', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('<d')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('exist')
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('{enter}')
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '</details>') // after selecting the hint, the last line of the inserted suggestion is active
|
|
|
|
cy.get('.markdown-body > details')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
it('via doubleclick', () => {
|
|
|
|
cy.get('.CodeMirror textarea')
|
|
|
|
.type('<d')
|
|
|
|
cy.get('.CodeMirror-hints > li')
|
|
|
|
.first()
|
|
|
|
.dblclick()
|
|
|
|
cy.get('.CodeMirror-hints')
|
|
|
|
.should('not.exist')
|
|
|
|
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
|
|
|
|
.should('have.text', '</details>')
|
|
|
|
cy.get('.markdown-body > details')
|
|
|
|
.should('exist')
|
|
|
|
})
|
|
|
|
})
|
2020-08-14 07:58:59 -04:00
|
|
|
})
|