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

[Update] Make vue/max-attributes-per-line fixable #380

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[add] autofix test max-attributes-per-line.js
ota-meshi committed Feb 6, 2018
commit 3f7b1c5c590c8e6d9c70e8f6131fb201821412ca
41 changes: 41 additions & 0 deletions tests/lib/rules/max-attributes-per-line.js
Original file line number Diff line number Diff line change
@@ -91,6 +91,8 @@ ruleTester.run('max-attributes-per-line', rule, {
invalid: [
{
code: `<template><component name="John Doe" age="30"></component></template>`,
output: `<template><component name="John Doe"
age="30"></component></template>`,
errors: ['Attribute "age" should be on a new line.']
},
{
@@ -99,6 +101,12 @@ ruleTester.run('max-attributes-per-line', rule, {
age="30">
</component>
</template>`,
output: `<template><component
job="Vet"
name="John Doe"
age="30">
</component>
</template>`,
errors: [{
message: 'Attribute "job" should be on a new line.',
type: 'VAttribute',
@@ -108,6 +116,8 @@ ruleTester.run('max-attributes-per-line', rule, {
{
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
options: [{ singleline: { max: 2 }}],
output: `<template><component name="John Doe" age="30"
job="Vet"></component></template>`,
errors: [{
message: 'Attribute "job" should be on a new line.',
type: 'VAttribute',
@@ -117,6 +127,8 @@ ruleTester.run('max-attributes-per-line', rule, {
{
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
options: [{ singleline: 1, multiline: { max: 1, allowFirstLine: false }}],
output: `<template><component name="John Doe"
age="30" job="Vet"></component></template>`,
errors: [{
message: 'Attribute "age" should be on a new line.',
type: 'VAttribute',
@@ -133,6 +145,11 @@ ruleTester.run('max-attributes-per-line', rule, {
</component>
</template>`,
options: [{ singleline: 3, multiline: { max: 1, allowFirstLine: false }}],
output: `<template><component
name="John Doe"
age="30">
</component>
</template>`,
errors: [{
message: 'Attribute "name" should be on a new line.',
type: 'VAttribute',
@@ -146,6 +163,12 @@ ruleTester.run('max-attributes-per-line', rule, {
</component>
</template>`,
options: [{ singleline: 3, multiline: { max: 1, allowFirstLine: false }}],
output: `<template><component
name="John Doe"
age="30"
job="Vet">
</component>
</template>`,
errors: [{
message: 'Attribute "age" should be on a new line.',
type: 'VAttribute',
@@ -159,6 +182,12 @@ ruleTester.run('max-attributes-per-line', rule, {
</component>
</template>`,
options: [{ singleline: 3, multiline: 1 }],
output: `<template><component
name="John Doe"
age="30"
job="Vet">
</component>
</template>`,
errors: [{
message: 'Attribute "age" should be on a new line.',
type: 'VAttribute',
@@ -172,6 +201,12 @@ ruleTester.run('max-attributes-per-line', rule, {
</component>
</template>`,
options: [{ singleline: 3, multiline: { max: 2, allowFirstLine: false }}],
output: `<template><component
name="John Doe" age="30"
job="Vet" pet="dog"
petname="Snoopy">
</component>
</template>`,
errors: [{
message: 'Attribute "petname" should be on a new line.',
type: 'VAttribute',
@@ -185,6 +220,12 @@ ruleTester.run('max-attributes-per-line', rule, {
</component>
</template>`,
options: [{ singleline: 3, multiline: { max: 2, allowFirstLine: false }}],
output: `<template><component
name="John Doe" age="30"
job="Vet" pet="dog"
petname="Snoopy" extra="foo">
</component>
</template>`,
errors: [{
message: 'Attribute "petname" should be on a new line.',
type: 'VAttribute',