Skip to content

Commit 32efb1f

Browse files
committed
chore: add ignore and ignore-all unit tests
1 parent 4ec18fc commit 32efb1f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/unit/render.test.js

+37
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,43 @@ describe('render', function() {
251251
</h6>`
252252
);
253253
});
254+
255+
it('ignore', async function() {
256+
const { docsify } = await init();
257+
const output = docsify.compiler.compile(
258+
'## h2 tag <!-- {docsify-ignore} -->'
259+
);
260+
expectSameDom(
261+
output,
262+
`
263+
<h2 id="h2-tag">
264+
<a href="#/?id=h2-tag" data-id="h2-tag" class="anchor">
265+
<span>h2 tag </span>
266+
</a>
267+
</h2>`
268+
);
269+
});
270+
271+
it('ignore-all', async function() {
272+
const { docsify } = await init();
273+
const output = docsify.compiler.compile(
274+
`# h1 tag <!-- {docsify-ignore-all} -->` + `\n## h2 tag`
275+
);
276+
expectSameDom(
277+
output,
278+
`
279+
<h1 id="h1-tag">
280+
<a href="#/?id=h1-tag" data-id="h1-tag" class="anchor">
281+
<span>h1 tag </span>
282+
</a>
283+
</h1>
284+
<h2 id="h2-tag">
285+
<a href="#/?id=h2-tag" data-id="h2-tag" class="anchor">
286+
<span>h2 tag</span>
287+
</a>
288+
</h2>`
289+
);
290+
});
254291
});
255292

256293
describe('link', function() {

0 commit comments

Comments
 (0)