Skip to content

Commit

Permalink
test: add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 15, 2021
1 parent 43f6585 commit b915e6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,18 @@ describe('rehype-attr test case', () => {
title: 'options="attr" - <ul> `- list`',
markdown: '- list \n<!--rehype:style=width:100px;-->',
expected: '<ul style="width:100px;">\n<li>list</li>\n</ul>\n<!--rehype:style=width:100px;-->',
}
},

{
title: 'options="attr" - test parameter value type ',
markdown: '#### This is a title\n<!--rehype:data-bool=true&data-bool2=false&data-num=213&data-num1=0213&data-str=2s13-->',
expected: '<h4 data-bool data-num="213" data-num1="0213" data-str="2s13">This is a title</h4>\n<!--rehype:data-bool=true&data-bool2=false&data-num=213&data-num1=0213&data-str=2s13-->',
},
{
title: 'options="attr" - test identifier',
markdown: '#### This is a title\n<!--wwww:data-bool=true',
expected: '<h4>This is a title</h4>\n',
},
].forEach((data, idx) => {
it(data.title, async () => {
const htmlStr = unified()
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.6",
"description": "New syntax to add attributes to Markdown.",
"author": "Kenny Wong <[email protected]>",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"prepack": "npm run build",
Expand Down Expand Up @@ -31,7 +32,9 @@
"ast",
"unified"
],
"license": "MIT",
"jest": {
"collectCoverageFrom": ["lib/*.js", "!lib/*.d.ts"]
},
"dependencies": {
"ts-mdast": "1.0.0",
"unified": "9.2.1"
Expand Down

0 comments on commit b915e6b

Please sign in to comment.