2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00
Files
bbob/packages/bbob-preset-vue/test/index.test.ts
T
Nikolay Kost 270f5645f8 fix(#206): TagNode.create now with null content argument by default (#233)
* fix: TagNode.create with null content by default

* Create five-meals-sing.md

* fix: tests

* fix(preset): types inference

* fix: preset types

* fix: preset types

* fix: lock file, parser and utils

* refactor: move types to separate package

* fix(preset): add @bbob/core to dev deps

* fix(preset): lock file

* test(preset-vue): create tags

* test(preset-vue): tests

* chore(nx): fix nx cover deps

* chore: changesets
2024-06-24 01:32:15 +03:00

29 lines
1.0 KiB
TypeScript

import type { PresetTagFunction } from "@bbob/types";
import preset, { createTags, tagAttr } from '../src'
const tagFactory = (tag: string): PresetTagFunction => jest.fn((...args) => ({ tag }))
const createTag = (tag: string, style: Record<string, string>) => ({ tag, ...tagAttr(style)})
describe('@bbob/preset-vue', () => {
test('is a function', () => {
expect(preset).toBeInstanceOf(Function)
})
test('createTags', () => {
const defTags = {
b: tagFactory('b'),
i: tagFactory('i'),
u: tagFactory('u'),
s: tagFactory('s'),
}
const tags = createTags(defTags)
const args = [{tag: 'test'}]
expect(tags.b?.({tag: 'b'}, ...args)).toEqual(createTag('b',{ fontWeight: 'bold' }))
expect(tags.i?.({tag: 'i'}, ...args)).toEqual(createTag('i',{ fontStyle: 'italic' }))
expect(tags.u?.({tag: 'u'}, ...args)).toEqual(createTag('u',{ textDecoration: 'underline' }))
expect(tags.s?.({tag: 's'}, ...args)).toEqual(createTag('s',{ textDecoration: 'line-through' }))
})
});