Skip to content

Commit

Permalink
Update tests for rule-selector-property-disallowed-list rule
Browse files Browse the repository at this point in the history
  • Loading branch information
doing-art committed Nov 1, 2021
1 parent acb229a commit f42f492
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions lib/rules/rule-selector-property-disallowed-list/__tests__/index.js
Expand Up @@ -5,55 +5,67 @@ const { messages, ruleName } = require('..');
testRule({
ruleName,
config: {
a: ['color', "/margin/"],
'/test/': ['/size/'],
a: ['color', '/margin/'],
'/foo/': ['/size/'],
},

accept: [
{
code: 'a { background: red; }',
},
{
code: 'a { color: red; }',
code: 'a { padding-top: 0px; }',
},
{
code: 'a { background: red; color: red; }',
code: 'a { background-color: red; }',
},
{
code: 'a[href="#"] { background-color: red; }',
code: 'a[href="#"] { color: red; }',
},
{
code: 'html.foo { background-color: red; }',
code: 'html.foo { color: red; }',
},
{
code: 'html[data-test] { background-color: red; }',
code: 'html[data-foo] { color: red; }',
},
],

reject: [
{
code: 'a { background-color: red; }',
message: messages.rejected('background-color', 'a'),
code: 'a { color: red; }',
message: messages.rejected('color', 'a'),
line: 1,
column: 5,
},
{
code: 'a { background: red; color: red; }',
message: messages.rejected('color', 'a'),
line: 1,
column: 22,
},
{
code: 'a { margin-top: 0px; }',
message: messages.rejected('margin-top', 'a'),
line: 1,
column: 5,
},
{
code: 'html { background-color: red; }',
message: messages.rejected('background-color', 'html'),
code: 'a { color: red; margin-top: 0px; }',
message: messages.rejected('color', 'a'),
line: 1,
column: 8,
column: 5,
},
{
code: '[data-test] { font-size: 1rem; }',
message: messages.rejected('font-size', '[data-test]'),
code: '[data-foo] { font-size: 1rem; }',
message: messages.rejected('font-size', '[data-foo]'),
line: 1,
column: 15,
column: 14,
},
{
code: 'html[data-test] { font-size: 1px; }',
message: messages.rejected('font-size', 'html[data-test]'),
code: 'html[data-foo] { font-size: 1px; }',
message: messages.rejected('font-size', 'html[data-foo]'),
line: 1,
column: 19,
column: 18,
},
],
});

0 comments on commit f42f492

Please sign in to comment.