Skip to content

Commit

Permalink
Add test for break in directive (text) label
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Dec 21, 2023
1 parent 6034170 commit 7f23ba8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import {directive, directiveHtml} from 'micromark-extension-directive'

const own = {}.hasOwnProperty

test('micromark-extension-directive (syntax, text)', async function (t) {
test('micromark-extension-directive (core)', async function (t) {
await t.test('should expose the public api', async function () {
assert.deepEqual(
Object.keys(await import('micromark-extension-directive')).sort(),
['directive', 'directiveHtml']
)
})
})

test('micromark-extension-directive (syntax, text)', async function (t) {
await t.test(
'should support an escaped colon which would otherwise be a directive',
async function () {
Expand Down Expand Up @@ -179,6 +181,16 @@ test('micromark-extension-directive (syntax, text)', async function (t) {
assert.equal(micromark(':a[a *b* c]asd', options()), '<p>asd</p>')
})

await t.test(
'should support markdown in an label (hard break)',
async function () {
assert.equal(
micromark(':x[a \nb]c', options({'*': h})),
'<p><x>a<br />\nb</x>c</p>'
)
}
)

await t.test('should support a directive in an label', async function () {
assert.equal(micromark('a :b[c :d[e] f] g', options()), '<p>a g</p>')
})
Expand Down

0 comments on commit 7f23ba8

Please sign in to comment.