Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built-in component tests in vue/component-name-in-template-casing #1737

Merged
merged 1 commit into from Dec 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.'
]
}
]
})