Skip to content

Commit

Permalink
add tests for "regex" option in id-naming-convention
Browse files Browse the repository at this point in the history
  • Loading branch information
seleb committed Dec 5, 2023
1 parent f386047 commit 0b00c19
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/eslint-plugin/tests/rules/id-naming-convention.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ ruleTester.run("id-naming-convention", rule, {
code: `<div id="snake_case"> </div>`,
options: ["snake_case"],
},
{
code: `<div id="CuStOmReGeX"> </div>`,
options: ["regex", { pattern: "^([A-Z][a-z])+[A-Z]?$" }],
},
],
invalid: [
{
Expand All @@ -41,5 +45,14 @@ ruleTester.run("id-naming-convention", rule, {
},
],
},
{
code: `<div id="kebab-case"> </div>`,
options: ["regex", { pattern: "^([A-Z][a-z])+[A-Z]?$" }],
errors: [
{
message: "The id 'kebab-case' is not matched with the regex.",
},
],
},
],
});

0 comments on commit 0b00c19

Please sign in to comment.