Skip to content

Commit 2b6a475

Browse files
committed
tests: attribute-hyphenation: Fix the ignore-list test
The test introduced in f9e1eee didn't actually test what it meant to test for. It attempts to verify that the ignore list is obeyed; but its subject is an element that is ignored in its entirety! The code under test was never triggered! Fix this by changing <div> for <custom> in the test case, and also add the same test-case without the `ignore` config, in order to verify that it actually has something to ignore.
1 parent f9e1eee commit 2b6a475

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: tests/lib/rules/attribute-hyphenation.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ruleTester.run('attribute-hyphenation', rule, {
4545
},
4646
{
4747
filename: 'test.vue',
48-
code: '<template><div data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hypen="foo"><a onClick="" my-prop="prop"></a></div></template>',
48+
code: '<template><custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hypen="foo"><a onClick="" my-prop="prop"></a></custom></template>',
4949
options: ['never', { 'ignore': ['custom-hypen'] }]
5050
}
5151
],
@@ -116,6 +116,20 @@ ruleTester.run('attribute-hyphenation', rule, {
116116
type: 'VDirectiveKey',
117117
line: 1
118118
}]
119+
},
120+
{
121+
// This is the same code as the `'ignore': ['custom-hypen']`
122+
// valid test; to verify that setting ignore actually makes the
123+
// difference.
124+
filename: 'test.vue',
125+
code: '<template><custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hypen="foo"><a onClick="" my-prop="prop"></a></custom></template>',
126+
output: '<template><custom data-id="foo" aria-test="bar" slot-scope="{ data }" customHypen="foo"><a onClick="" my-prop="prop"></a></custom></template>',
127+
options: ['never'],
128+
errors: [{
129+
message: "Attribute 'custom-hypen' cann't be hyphenated.",
130+
type: 'VIdentifier',
131+
line: 1
132+
}]
119133
}
120134
]
121135
})

0 commit comments

Comments
 (0)