44const { stripIndent } = require ( 'common-tags' )
55import { extractFiddles } from '../../src/markdown-utils'
66
7- chai . config . truncateThreshold = 1000
7+ chai . config . truncateThreshold = 1500
88
99/** @type {string } */
1010let fiddleCommentMarkdown
1111/** @type {string } */
1212let fiddleHtmlBlocksMarkdown
13+ /** @type {string } */
14+ let fiddleHideHtmlBlocksMarkdown
1315
1416before ( ( ) => {
1517 cy . readFile ( 'cypress/integration/fiddle-comment.md' ) . then (
@@ -19,6 +21,10 @@ before(() => {
1921 cy . readFile ( 'cypress/integration/multiple-html-blocks.md' ) . then (
2022 ( md ) => ( fiddleHtmlBlocksMarkdown = md ) ,
2123 )
24+
25+ cy . readFile ( 'cypress/integration/hide-html.md' ) . then (
26+ ( md ) => ( fiddleHideHtmlBlocksMarkdown = md ) ,
27+ )
2228} )
2329
2430describe ( 'extractFiddles' , ( ) => {
@@ -190,4 +196,24 @@ describe('extractFiddles', () => {
190196 export : false ,
191197 } )
192198 } )
199+
200+ it ( 'hides html block' , ( ) => {
201+ const fiddles = extractFiddles ( fiddleHideHtmlBlocksMarkdown )
202+ const fiddle = fiddles [ 'Hide HTML block' ] [ 0 ]
203+ expect ( fiddle ) . to . deep . equal ( {
204+ name : 'HTML source not shown' ,
205+ test : "cy.get('div#greeting').should('have.text', 'Hello')" ,
206+ html : [
207+ {
208+ source : '<div id="greeting">Hello</div>' ,
209+ hide : true ,
210+ } ,
211+ ] ,
212+ commonHtml : null ,
213+ css : null ,
214+ only : false ,
215+ skip : false ,
216+ export : false ,
217+ } )
218+ } )
193219} )
0 commit comments