Update MD044/proper-names to add html_elements parameter (fixes #435).

This commit is contained in:
David Anson 2022-04-25 21:50:33 -07:00
parent 8afec14376
commit 0f845e9ba1
15 changed files with 186 additions and 14 deletions

View file

@ -1283,3 +1283,43 @@ test("forEachLink", (t) => {
t.is(matches.length, 0, "Missing match");
}
});
test("htmlElementRanges", (t) => {
t.plan(1);
const params = {
"lines": [
"# Heading",
"",
"Text text text",
"text <a id='id'/> text",
"text text text",
"",
"<p>",
"Text <em>text</em> text",
"</p>",
"",
"```",
"<br/>",
"```",
"",
"Text `<br/>` text",
"text <br/> text"
],
"tokens": [
{
"type": "code_block",
"map": [ 10, 12 ]
}
]
};
const expected = [
[ 3, 5, 12 ],
[ 6, 0, 3 ],
[ 7, 5, 4 ],
[ 14, 6, 5 ],
[ 15, 5, 5 ]
];
const lineMetadata = helpers.getLineMetadata(params);
const actual = helpers.htmlElementRanges(params, lineMetadata);
t.deepEqual(actual, expected);
});