Skip to content

Commit 0d3818b

Browse files
authored
test(max-attributes-per-line): make tests more strict (#2846)
1 parent 5964602 commit 0d3818b

File tree

1 file changed

+75
-10
lines changed

1 file changed

+75
-10
lines changed

tests/lib/rules/max-attributes-per-line.js

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,43 +44,99 @@ ruleTester.run('max-attributes-per-line', rule, {
4444
code: `<template><component name="John Doe" age="30"></component></template>`,
4545
output: `<template><component name="John Doe"
4646
age="30"></component></template>`,
47-
errors: ["'age' should be on a new line."]
47+
errors: [
48+
{
49+
message: "'age' should be on a new line.",
50+
line: 1,
51+
column: 38,
52+
endLine: 1,
53+
endColumn: 46
54+
}
55+
]
4856
},
4957
{
5058
code: `<template><component :name="user.name" :age="user.age"></component></template>`,
5159
output: `<template><component :name="user.name"
5260
:age="user.age"></component></template>`,
53-
errors: ["':age' should be on a new line."]
61+
errors: [
62+
{
63+
message: "':age' should be on a new line.",
64+
line: 1,
65+
column: 40,
66+
endLine: 1,
67+
endColumn: 55
68+
}
69+
]
5470
},
5571
{
5672
code: `<template><component :is="test" v-bind="user"></component></template>`,
5773
output: `<template><component :is="test"
5874
v-bind="user"></component></template>`,
59-
errors: ["'v-bind' should be on a new line."]
75+
errors: [
76+
{
77+
message: "'v-bind' should be on a new line.",
78+
line: 1,
79+
column: 33,
80+
endLine: 1,
81+
endColumn: 46
82+
}
83+
]
6084
},
6185
{
6286
code: `<template><component :name="user.name" @buy="buyProduct"></component></template>`,
6387
output: `<template><component :name="user.name"
6488
@buy="buyProduct"></component></template>`,
65-
errors: ["'@buy' should be on a new line."]
89+
errors: [
90+
{
91+
message: "'@buy' should be on a new line.",
92+
line: 1,
93+
column: 40,
94+
endLine: 1,
95+
endColumn: 57
96+
}
97+
]
6698
},
6799
{
68100
code: `<template><component :name="user.name" @click.stop></component></template>`,
69101
output: `<template><component :name="user.name"
70102
@click.stop></component></template>`,
71-
errors: ["'@click.stop' should be on a new line."]
103+
errors: [
104+
{
105+
message: "'@click.stop' should be on a new line.",
106+
line: 1,
107+
column: 40,
108+
endLine: 1,
109+
endColumn: 51
110+
}
111+
]
72112
},
73113
{
74114
code: `<template><component :name="user.name" v-if="something"></component></template>`,
75115
output: `<template><component :name="user.name"
76116
v-if="something"></component></template>`,
77-
errors: ["'v-if' should be on a new line."]
117+
errors: [
118+
{
119+
message: "'v-if' should be on a new line.",
120+
line: 1,
121+
column: 40,
122+
endLine: 1,
123+
endColumn: 56
124+
}
125+
]
78126
},
79127
{
80128
code: `<template><component name="John Doe" v-bind:age="user.age"></component></template>`,
81129
output: `<template><component name="John Doe"
82130
v-bind:age="user.age"></component></template>`,
83-
errors: ["'v-bind:age' should be on a new line."]
131+
errors: [
132+
{
133+
message: "'v-bind:age' should be on a new line.",
134+
line: 1,
135+
column: 41,
136+
endLine: 1,
137+
endColumn: 62
138+
}
139+
]
84140
},
85141
{
86142
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
@@ -91,7 +147,10 @@ job="Vet"></component></template>`,
91147
{
92148
message: "'job' should be on a new line.",
93149
type: 'VAttribute',
94-
line: 1
150+
line: 1,
151+
column: 47,
152+
endLine: 1,
153+
endColumn: 56
95154
}
96155
]
97156
},
@@ -112,7 +171,10 @@ age="30"
112171
{
113172
message: "'age' should be on a new line.",
114173
type: 'VAttribute',
115-
line: 2
174+
line: 2,
175+
column: 25,
176+
endLine: 2,
177+
endColumn: 33
116178
}
117179
]
118180
},
@@ -133,7 +195,10 @@ age="30"
133195
{
134196
message: "'age' should be on a new line.",
135197
type: 'VAttribute',
136-
line: 2
198+
line: 2,
199+
column: 25,
200+
endLine: 2,
201+
endColumn: 33
137202
}
138203
]
139204
}

0 commit comments

Comments
 (0)