Skip to content

Commit

Permalink
Add tests for verification purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukehirao committed Feb 10, 2024
1 parent d253aea commit 3274a51
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/@markuplint/rules/src/permitted-contents/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1501,4 +1501,29 @@ describe('Issues', () => {
const sourceCode = '<svg><text><tspan>Text</tspan></text></svg>';
expect((await mlRuleTest(rule, sourceCode)).violations).toStrictEqual([]);
});

test('#1451', async () => {
const astro = { parser: { '.*': '@markuplint/astro-parser' } };
const jsx = { parser: { '.*': '@markuplint/jsx-parser' } };
const pug = { parser: { '.*': '@markuplint/pug-parser' } };
const svelte = { parser: { '.*': '@markuplint/svelte-parser' } };
const vue = { parser: { '.*': '@markuplint/vue-parser' } };

expect((await mlRuleTest(rule, '<span><div></div></span>')).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><Div></Div></span>')).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><div></div></span>', astro)).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><Div></Div></span>', astro)).violations.length).toBe(0);
expect((await mlRuleTest(rule, '<span><div></div></span>', jsx)).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><Div></Div></span>', jsx)).violations.length).toBe(0);
expect((await mlRuleTest(rule, 'span: div', pug)).violations.length).toBe(1);
expect((await mlRuleTest(rule, 'span: Div', pug)).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><div></div></span>', svelte)).violations.length).toBe(1);
expect((await mlRuleTest(rule, '<span><Div></Div></span>', svelte)).violations.length).toBe(0);
expect((await mlRuleTest(rule, '<template><span><div></div></span></template>', vue)).violations.length).toBe(
1,
);
expect((await mlRuleTest(rule, '<template><span><Div></Div></span></template>', vue)).violations.length).toBe(
0,
);
});
});

0 comments on commit 3274a51

Please sign in to comment.