Skip to content

Commit ff3ea00

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

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

cypress/e2e/nodes/CodeBlock.spec.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ 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.get('#app-content').scrollTo('bottom')
83+
cy.getContent().find('.split-view__preview').eq(2).should('be.visible')
84+
cy.get('.code-block').eq(2).find('code').should('not.be.visible')
85+
cy.get('.split-view__preview').find('svg title')
86+
.contains('Order example')
87+
})
88+
})
89+
6590
it('Add a code block', function() {
6691
cy.isolateTest({ sourceFile: 'codeblock.md' })
6792
cy.openFile('codeblock.md').then(() => {

0 commit comments

Comments
 (0)