Skip to content

Commit 07bb0ea

Browse files
committedSep 28, 2022
test: fix test case error & add test case.
1 parent 35796b3 commit 07bb0ea

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎test/index.test.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ describe('rehype-attr function test case', () => {
6767
expect(utils.propertiesHandle(null, {}, 'string')).toEqual({
6868
'data-config': '{\"rehyp\":true}'
6969
});
70-
expect(utils.propertiesHandle(null, null, 'string')).toEqual({
70+
expect(utils.propertiesHandle(null, (null as unknown as undefined), 'string')).toEqual({
7171
'data-config': '{\"rehyp\":true}'
7272
});
73-
expect(utils.propertiesHandle(null, null, 'attr')).toEqual({});
73+
expect(utils.propertiesHandle(null, (null as unknown as undefined), 'attr')).toEqual({});
7474
expect(utils.propertiesHandle(null, { a: 1 }, 'attr')).toEqual({ a: 1 });
7575
});
7676
})
@@ -123,7 +123,7 @@ describe('rehype-attr test case', () => {
123123
}, {
124124
title: 'options="attr" - Table 2 `\\n\\n` ???',
125125
markdown: '| Property | Description |\n |---- |---- |\n | 1 | 2 |\n<!--rehype:border=1-->',
126-
expected: '<table><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr><tr><td><!--rehype:border=1--></td><td></td></tr></tbody></table>',
126+
expected: '<table border="1"><thead><tr><th>Property</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>\n<!--rehype:border=1-->',
127127
}
128128
].forEach((data, idx) => {
129129
it(data.title, async () => {
@@ -292,6 +292,11 @@ describe('rehype-attr test case', () => {
292292
markdown: '#### This is a title\n<!--wwww:data-bool=true',
293293
expected: '<h4>This is a title</h4>\n',
294294
},
295+
{
296+
title: 'options="attr" - test identifier',
297+
markdown: '#### This is a title\n<!--rehype:style=background-color: rgb(235 217 78/var(--bg-opacity));-->',
298+
expected: '<h4 style="background-color: rgb(235 217 78/var(--bg-opacity));">This is a title</h4>\n<!--rehype:style=background-color: rgb(235 217 78/var(--bg-opacity));-->',
299+
},
295300
].forEach((data, idx) => {
296301
it(data.title, async () => {
297302
const htmlStr = unified()

0 commit comments

Comments
 (0)
Please sign in to comment.