Skip to content

Commit

Permalink
added custom-event-name-casing invalid test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
devTeaa committed Oct 9, 2020
1 parent b104289 commit 750e23f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/lib/rules/custom-event-name-casing.js
Expand Up @@ -336,6 +336,68 @@ tester.run('custom-event-name-casing', rule, {
"Custom event name 'barBaz' must be kebab-case.",
"Custom event name 'bazQux' must be kebab-case."
]
},
{
filename: 'test.vue',
code: `
<template>
<input
@click="$emit('input/update')">
</template>
<script>
export default {
setup(props, context) {
return {
onInput(value) {
context.emit('search/update')
}
}
},
methods: {
onClick() {
this.$emit('click/row')
}
}
}
</script>
`,
options: [{ ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] }],
errors: [
"Custom event name 'input/update' must be kebab-case.",
"Custom event name 'search/update' must be kebab-case.",
"Custom event name 'click/row' must be kebab-case."
]
},
{
filename: 'test.vue',
code: `
<template>
<input
@click="$emit('input/update')">
</template>
<script>
export default {
setup(props, context) {
return {
onInput(value) {
context.emit('search/update')
}
}
},
methods: {
onClick() {
this.$emit('click/row')
}
}
}
</script>
`,
options: [{ ignores: ['input:update', 'search:update', 'click:row'] }],
errors: [
"Custom event name 'input/update' must be kebab-case.",
"Custom event name 'search/update' must be kebab-case.",
"Custom event name 'click/row' must be kebab-case."
]
}
]
})

0 comments on commit 750e23f

Please sign in to comment.