Skip to content

Commit

Permalink
Add built-in component tests in `vue/component-name-in-template-casin…
Browse files Browse the repository at this point in the history
…g` (#1737)
  • Loading branch information
FloEdelmann committed Dec 4, 2021
1 parent 09d7bed commit 024c8d8
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/lib/rules/component-name-in-template-casing.js
Expand Up @@ -69,6 +69,10 @@ tester.run('component-name-in-template-casing', rule, {
code: '<template><div><slot></slot></div></template>',
options: ['PascalCase', { registeredComponentsOnly: false }]
},
{
code: '<template><div><template v-if="foo">bar</template></div></template>',
options: ['PascalCase', { registeredComponentsOnly: false }]
},
{
code: '<template><h1>Title</h1></template>',
options: ['PascalCase', { registeredComponentsOnly: false }]
Expand Down Expand Up @@ -151,6 +155,19 @@ tester.run('component-name-in-template-casing', rule, {
{
code: '<template><the-component><!--test</the-component></template>',
options: ['PascalCase', { registeredComponentsOnly: false }]
},

// built-in components (behave the same way as other components)
{
code: `
<template>
<component />
<suspense />
<teleport />
<client-only />
<keep-alive />
</template>
`
}
],
invalid: [
Expand Down Expand Up @@ -768,6 +785,35 @@ tester.run('component-name-in-template-casing', rule, {
'Component name "FooBar" is not kebab-case.',
'Component name "FooBar_Baz-qux" is not kebab-case.'
]
},
{
// built-in components (behave the same way as other components)
code: `
<template>
<component />
<suspense />
<teleport />
<client-only />
<keep-alive />
</template>
`,
output: `
<template>
<Component />
<Suspense />
<Teleport />
<ClientOnly />
<KeepAlive />
</template>
`,
options: ['PascalCase', { registeredComponentsOnly: false }],
errors: [
'Component name "component" is not PascalCase.',
'Component name "suspense" is not PascalCase.',
'Component name "teleport" is not PascalCase.',
'Component name "client-only" is not PascalCase.',
'Component name "keep-alive" is not PascalCase.'
]
}
]
})

0 comments on commit 024c8d8

Please sign in to comment.