Skip to content

Commit

Permalink
Add tests for new callout syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jhildenbiddle authored and sy-records committed Aug 11, 2024
1 parent db423b6 commit 6cf5f36
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions test/integration/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,60 @@ import { waitForText } from '../helpers/wait-for.js';
describe('render', function () {
// Helpers
// ---------------------------------------------------------------------------
describe('helpers', () => {
describe('callouts', () => {
beforeEach(async () => {
await docsifyInit();
});

test('important content', () => {
test('caution', () => {
const output = window.marked('> [!CAUTION]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout caution"><p>Text</p></div>"`,
);
});

test('important', () => {
const output = window.marked('> [!IMPORTANT]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout important"><p>Text</p></div>"`,
);
});

test('note', () => {
const output = window.marked('> [!NOTE]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout note"><p>Text</p></div>"`,
);
});

test('tip', () => {
const output = window.marked('> [!TIP]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout tip"><p>Text</p></div>"`,
);
});

test('warning', () => {
const output = window.marked('> [!WARNING]\n> Text');

expect(output).toMatchInlineSnapshot(
`"<div class="callout warning"><p>Text</p></div>"`,
);
});

test('important (legacy)', () => {
const output = window.marked('!> Important content');

expect(output).toMatchInlineSnapshot(
`"<p class="callout important">Important content</p>"`,
);
});

test('general tip', () => {
test('tip (legacy)', () => {
const output = window.marked('?> General tip');

expect(output).toMatchInlineSnapshot(
Expand Down

0 comments on commit 6cf5f36

Please sign in to comment.