Skip to content

Commit

Permalink
tests(cypress): Add read only code block test
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Aug 30, 2023
1 parent 5aa527e commit 49aec00
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cypress/e2e/nodes/CodeBlock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,30 @@ describe('Front matter support', function() {
})
})

it.only('Show a code block in a public read only link', function() {
cy.shareFile('/codeblock.md')
.then((token) => {
cy.logout()
cy.visit(`/s/${token}`)
})
.then(() => {
cy.getEditor().should('be.visible')
// Plain text block
cy.getContent().find('code').eq(0).find('.hljs-keyword').should('not.exist')

// Javascript block
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(0).contains('const')
cy.getContent().find('code').eq(1).find('.hljs-string').eq(0).contains('"bar"')
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(1).contains('function')

// Mermaid diagram
cy.getContent().find('.split-view__preview').eq(2).should()
cy.get('.code-block').eq(2).find('code').should('not.be.visible')
cy.get('.split-view__preview').find('svg title')
.contains('Order example')
})
})

it('Add a code block', function() {
cy.isolateTest({ sourceFile: 'codeblock.md' })
cy.openFile('codeblock.md').then(() => {
Expand Down

0 comments on commit 49aec00

Please sign in to comment.