Skip to content

Commit 49aec00

Browse files
committed
tests(cypress): Add read only code block test
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 5aa527e commit 49aec00

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

cypress/e2e/nodes/CodeBlock.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ describe('Front matter support', function() {
6262
})
6363
})
6464

65+
it.only('Show a code block in a public read only link', function() {
66+
cy.shareFile('/codeblock.md')
67+
.then((token) => {
68+
cy.logout()
69+
cy.visit(`/s/${token}`)
70+
})
71+
.then(() => {
72+
cy.getEditor().should('be.visible')
73+
// Plain text block
74+
cy.getContent().find('code').eq(0).find('.hljs-keyword').should('not.exist')
75+
76+
// Javascript block
77+
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(0).contains('const')
78+
cy.getContent().find('code').eq(1).find('.hljs-string').eq(0).contains('"bar"')
79+
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(1).contains('function')
80+
81+
// Mermaid diagram
82+
cy.getContent().find('.split-view__preview').eq(2).should()
83+
cy.get('.code-block').eq(2).find('code').should('not.be.visible')
84+
cy.get('.split-view__preview').find('svg title')
85+
.contains('Order example')
86+
})
87+
})
88+
6589
it('Add a code block', function() {
6690
cy.isolateTest({ sourceFile: 'codeblock.md' })
6791
cy.openFile('codeblock.md').then(() => {

0 commit comments

Comments
 (0)