vuepress-theme-plume/plugins/plugin-md-power/__test__/createContainerPlugin.spec.ts
pengzhanbo 30d707036e
perf: improve markdown container plugin (#320)
* perf: improve markdown container plugin

* chore: add unit test

* chore: improve styles
2024-10-31 01:42:54 +08:00

23 lines
702 B
TypeScript

import MarkdownIt from 'markdown-it'
import { describe, expect, it } from 'vitest'
import { createContainerPlugin } from '../src/node/container/createContainer.js'
describe('createContainerPlugin', () => {
it('should work with default options', () => {
const md = new MarkdownIt()
createContainerPlugin(md, 'test')
expect(md.render(':::test\ncontent\n:::')).toContain('class="custom-container test"')
})
it('should work with custom render', () => {
const md = new MarkdownIt()
createContainerPlugin(md, 'test', {
before: () => `<div class="test">`,
after: () => `</div>`,
})
expect(md.render(':::test\ncontent\n:::')).toContain('class="test"')
})
})