Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 87b399e

Browse files
authored
test(no-multiple-template-root): make tests more strict (#2904)
1 parent 508cfe2 commit 87b399e

File tree

1 file changed

+117
-18
lines changed

1 file changed

+117
-18
lines changed

‎tests/lib/rules/no-multiple-template-root.js

Lines changed: 117 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,42 +128,106 @@ ruleTester.run('no-multiple-template-root', rule, {
128128
{
129129
filename: 'test.vue',
130130
code: '<template><div></div><div></div></template>',
131-
errors: ['The template root requires exactly one element.']
131+
errors: [
132+
{
133+
message: 'The template root requires exactly one element.',
134+
line: 1,
135+
column: 22,
136+
endLine: 1,
137+
endColumn: 33
138+
}
139+
]
132140
},
133141
{
134142
filename: 'test.vue',
135143
code: '<template>\n <div></div>\n <div></div>\n</template>',
136-
errors: ['The template root requires exactly one element.']
144+
errors: [
145+
{
146+
message: 'The template root requires exactly one element.',
147+
line: 3,
148+
column: 5,
149+
endLine: 3,
150+
endColumn: 16
151+
}
152+
]
137153
},
138154
{
139155
filename: 'test.vue',
140156
code: '<template>{{a b c}}</template>',
141-
errors: ['The template root requires an element rather than texts.']
157+
errors: [
158+
{
159+
message: 'The template root requires an element rather than texts.',
160+
line: 1,
161+
column: 11,
162+
endLine: 1,
163+
endColumn: 20
164+
}
165+
]
142166
},
143167
{
144168
filename: 'test.vue',
145169
code: '<template><div></div>aaaaaa</template>',
146-
errors: ['The template root requires an element rather than texts.']
170+
errors: [
171+
{
172+
message: 'The template root requires an element rather than texts.',
173+
line: 1,
174+
column: 22,
175+
endLine: 1,
176+
endColumn: 28
177+
}
178+
]
147179
},
148180
{
149181
filename: 'test.vue',
150182
code: '<template>aaaaaa<div></div></template>',
151-
errors: ['The template root requires an element rather than texts.']
183+
errors: [
184+
{
185+
message: 'The template root requires an element rather than texts.',
186+
line: 1,
187+
column: 11,
188+
endLine: 1,
189+
endColumn: 17
190+
}
191+
]
152192
},
153193
{
154194
filename: 'test.vue',
155195
code: '<template><div v-for="x in list"></div></template>',
156-
errors: ["The template root disallows 'v-for' directives."]
196+
errors: [
197+
{
198+
message: "The template root disallows 'v-for' directives.",
199+
line: 1,
200+
column: 11,
201+
endLine: 1,
202+
endColumn: 34
203+
}
204+
]
157205
},
158206
{
159207
filename: 'test.vue',
160208
code: '<template><slot></slot></template>',
161-
errors: ["The template root disallows '<slot>' elements."]
209+
errors: [
210+
{
211+
message: "The template root disallows '<slot>' elements.",
212+
line: 1,
213+
column: 11,
214+
endLine: 1,
215+
endColumn: 17
216+
}
217+
]
162218
},
163219
{
164220
filename: 'test.vue',
165221
code: '<template><template></template></template>',
166-
errors: ["The template root disallows '<template>' elements."]
222+
errors: [
223+
{
224+
message: "The template root disallows '<template>' elements.",
225+
line: 1,
226+
column: 11,
227+
endLine: 1,
228+
endColumn: 21
229+
}
230+
]
167231
},
168232
{
169233
code: `
@@ -177,11 +241,17 @@ ruleTester.run('no-multiple-template-root', rule, {
177241
errors: [
178242
{
179243
message: 'The template root disallows comments.',
180-
line: 3
244+
line: 3,
245+
column: 9,
246+
endLine: 3,
247+
endColumn: 26
181248
},
182249
{
183250
message: 'The template root disallows comments.',
184-
line: 5
251+
line: 5,
252+
column: 9,
253+
endLine: 5,
254+
endColumn: 26
185255
}
186256
]
187257
},
@@ -199,7 +269,10 @@ ruleTester.run('no-multiple-template-root', rule, {
199269
errors: [
200270
{
201271
message: 'The template root disallows comments.',
202-
line: 3
272+
line: 3,
273+
column: 9,
274+
endLine: 3,
275+
endColumn: 26
203276
}
204277
]
205278
},
@@ -227,15 +300,24 @@ ruleTester.run('no-multiple-template-root', rule, {
227300
errors: [
228301
{
229302
message: 'The template root disallows comments.',
230-
line: 3
303+
line: 3,
304+
column: 9,
305+
endLine: 3,
306+
endColumn: 26
231307
},
232308
{
233309
message: 'The template root disallows comments.',
234-
line: 12
310+
line: 12,
311+
column: 9,
312+
endLine: 12,
313+
endColumn: 26
235314
},
236315
{
237316
message: 'The template root disallows comments.',
238-
line: 17
317+
line: 17,
318+
column: 9,
319+
endLine: 17,
320+
endColumn: 26
239321
}
240322
]
241323
},
@@ -253,7 +335,10 @@ ruleTester.run('no-multiple-template-root', rule, {
253335
errors: [
254336
{
255337
message: 'The template root disallows comments.',
256-
line: 7
338+
line: 7,
339+
column: 9,
340+
endLine: 7,
341+
endColumn: 26
257342
}
258343
]
259344
},
@@ -269,11 +354,17 @@ ruleTester.run('no-multiple-template-root', rule, {
269354
errors: [
270355
{
271356
message: 'The template root disallows comments.',
272-
line: 4
357+
line: 4,
358+
column: 9,
359+
endLine: 4,
360+
endColumn: 26
273361
},
274362
{
275363
message: 'The template root requires exactly one element.',
276-
line: 5
364+
line: 5,
365+
column: 9,
366+
endLine: 5,
367+
endColumn: 16
277368
}
278369
]
279370
},
@@ -289,7 +380,15 @@ ruleTester.run('no-multiple-template-root', rule, {
289380
</template>
290381
`,
291382
options: [{ disallowComments: true }],
292-
errors: ['The template root disallows comments.']
383+
errors: [
384+
{
385+
message: 'The template root disallows comments.',
386+
line: 3,
387+
column: 9,
388+
endLine: 4,
389+
endColumn: 96
390+
}
391+
]
293392
}
294393
]
295394
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /