Wrap markdown rendering in iframe (#837)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2021-01-24 20:50:51 +01:00 committed by GitHub
parent bd31076928
commit 586969f368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1014 additions and 287 deletions

View file

@ -26,7 +26,8 @@ describe('Autocompletion', () => {
.should('have.text', '```abnf')
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
.should('have.text', '```')
cy.get('.markdown-body > pre > code')
cy.getMarkdownBody()
.find('pre > code')
.should('exist')
})
it('via doubleclick', () => {
@ -40,7 +41,8 @@ describe('Autocompletion', () => {
.should('have.text', '```abnf')
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span span')
.should('have.text', '```')
cy.get('.markdown-body > pre > code')
cy.getMarkdownBody()
.find('pre > code')
.should('exist')
})
})
@ -58,7 +60,8 @@ describe('Autocompletion', () => {
.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')
cy.getMarkdownBody()
.find('div.alert')
.should('exist')
})
it('via doubleclick', () => {
@ -72,7 +75,8 @@ describe('Autocompletion', () => {
.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')
cy.getMarkdownBody()
.find('div.alert')
.should('exist')
})
})
@ -80,8 +84,7 @@ describe('Autocompletion', () => {
describe('emoji', () => {
describe('normal emoji', () => {
it('via Enter', () => {
cy.get('@codeinput')
.fill(':hedg')
cy.codemirrorFill(':hedg')
cy.get('.CodeMirror-hints')
.should('exist')
cy.get('@codeinput')
@ -90,12 +93,11 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', ':hedgehog:')
cy.get('.markdown-body')
cy.getMarkdownBody()
.should('have.text', '🦔')
})
it('via doubleclick', () => {
cy.get('@codeinput')
.fill(':hedg')
cy.codemirrorFill(':hedg')
cy.get('.CodeMirror-hints > li')
.first()
.dblclick()
@ -103,15 +105,14 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', ':hedgehog:')
cy.get('.markdown-body')
cy.getMarkdownBody()
.should('have.text', '🦔')
})
})
describe('fork-awesome-icon', () => {
it('via Enter', () => {
cy.get('@codeinput')
.fill(':fa-face')
cy.codemirrorFill(':fa-face')
cy.get('.CodeMirror-hints')
.should('exist')
cy.get('@codeinput')
@ -120,12 +121,12 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', ':fa-facebook:')
cy.get('.markdown-body > p > i.fa.fa-facebook')
cy.getMarkdownBody()
.find('p > i.fa.fa-facebook')
.should('exist')
})
it('via doubleclick', () => {
cy.get('@codeinput')
.fill(':fa-face')
cy.codemirrorFill(':fa-face')
cy.get('.CodeMirror-hints > li')
.first()
.dblclick()
@ -133,7 +134,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', ':fa-facebook:')
cy.get('.markdown-body > p > i.fa.fa-facebook')
cy.getMarkdownBody()
.find('p > i.fa.fa-facebook')
.should('exist')
})
})
@ -150,7 +152,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '# ')
cy.get('.markdown-body > h1 ')
cy.getMarkdownBody()
.find('h1 ')
.should('have.text', ' ')
})
it('via doubleclick', () => {
@ -162,7 +165,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '# ')
cy.get('.markdown-body > h1')
cy.getMarkdownBody()
.find('h1')
.should('have.text', ' ')
})
})
@ -178,7 +182,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '![image alt](https:// "title")')
cy.get('.markdown-body > p > img')
cy.getMarkdownBody()
.find('p > img')
.should('have.attr', 'alt', 'image alt')
.should('have.attr', 'src', 'https://')
.should('have.attr', 'title', 'title')
@ -192,7 +197,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '![image alt](https:// "title")')
cy.get('.markdown-body > p > img')
cy.getMarkdownBody()
.find('p > img')
.should('have.attr', 'alt', 'image alt')
.should('have.attr', 'src', 'https://')
.should('have.attr', 'title', 'title')
@ -210,7 +216,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '[link text](https:// "title") ')
cy.get('.markdown-body > p > a')
cy.getMarkdownBody()
.find('p > a')
.should('have.text', 'link text')
.should('have.attr', 'href', 'https://')
.should('have.attr', 'title', 'title')
@ -224,7 +231,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '[link text](https:// "title") ')
cy.get('.markdown-body > p > a')
cy.getMarkdownBody()
.find('p > a')
.should('have.text', 'link text')
.should('have.attr', 'href', 'https://')
.should('have.attr', 'title', 'title')
@ -242,7 +250,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '{%pdf https:// %}')
cy.get('.markdown-body > p')
cy.getMarkdownBody()
.find('p')
.should('exist')
})
it('via doubleclick', () => {
@ -254,7 +263,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '{%pdf https:// %}')
cy.get('.markdown-body > p')
cy.getMarkdownBody()
.find('p')
.should('exist')
})
})
@ -270,7 +280,8 @@ describe('Autocompletion', () => {
.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')
cy.getMarkdownBody()
.find('details')
.should('exist')
})
it('via doubleclick', () => {
@ -282,7 +293,8 @@ describe('Autocompletion', () => {
.should('not.exist')
cy.get('.CodeMirror-activeline > .CodeMirror-line > span')
.should('have.text', '</details>')
cy.get('.markdown-body > details')
cy.getMarkdownBody()
.find('details')
.should('exist')
})
})