Skip to content

Commit 374f6ea

Browse files
committed
chore(valid-v-for): Fix test cases
1 parent da09d6c commit 374f6ea

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

tests/lib/rules/valid-v-for.js

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ tester.run('valid-v-for', rule, {
7777
},
7878
{
7979
filename: 'test.vue',
80-
code: '<template v-for="x of list"><slot name="item" /></template>'
80+
code: '<template><template v-for="x of list"><slot name="item" /></template></template>'
8181
},
8282
{
8383
filename: 'test.vue',
84-
code: '<template v-for="x of list">foo<div></div></template>'
84+
code: '<template><template v-for="x of list">foo<div></div></template></template>'
8585
},
8686
{
8787
filename: 'test.vue',
@@ -90,22 +90,26 @@ tester.run('valid-v-for', rule, {
9090
{
9191
filename: 'test.vue',
9292
code: `
93-
<template v-for="x in xs">
94-
<template v-for="y in x.ys">
95-
<li v-for="z in y.zs" :key="z.id">
96-
123
97-
</li>
93+
<template>
94+
<template v-for="x in xs">
95+
<template v-for="y in x.ys">
96+
<li v-for="z in y.zs" :key="z.id">
97+
123
98+
</li>
99+
</template>
98100
</template>
99101
</template>`
100102
},
101103
{
102104
filename: 'test.vue',
103105
code: `
104-
<template v-for="x in xs">
105-
<template v-for="y in ys">
106-
<li v-for="z in zs" :key="x.id + y.id + z.id">
107-
123
108-
</li>
106+
<template>
107+
<template v-for="x in xs">
108+
<template v-for="y in ys">
109+
<li v-for="z in zs" :key="x.id + y.id + z.id">
110+
123
111+
</li>
112+
</template>
109113
</template>
110114
</template>`
111115
}
@@ -215,38 +219,43 @@ tester.run('valid-v-for', rule, {
215219
filename: 'test.vue',
216220
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
217221
code: `
218-
<template v-for="x in xs">
219-
<template v-for="y in a.ys">
220-
<li v-for="z in y.zs" :key="z.id">
221-
123
222-
</li>
222+
<template>
223+
<template v-for="x in xs">
224+
<template v-for="y in a.ys">
225+
<li v-for="z in y.zs" :key="z.id">
226+
123
227+
</li>
228+
</template>
223229
</template>
224230
</template>`
225231
},
226232
{
227233
filename: 'test.vue',
228234
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
229235
code: `
230-
<template v-for="x in xs">
231-
<template v-for="y in x.ys">
232-
<li v-for="z in a.zs" :key="z.id">
233-
123
234-
</li>
236+
<template>
237+
<template v-for="x in xs">
238+
<template v-for="y in x.ys">
239+
<li v-for="z in a.zs" :key="z.id">
240+
123
241+
</li>
242+
</template>
235243
</template>
236244
</template>`
237245
},
238246
{
239247
filename: 'test.vue',
240248
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
241249
code: `
242-
<template v-for="x in xs">
243-
<template v-for="y in x.ys">
244-
<li v-for="z in x.zs" :key="z.id">
245-
123
246-
</li>
250+
<template>
251+
<template v-for="x in xs">
252+
<template v-for="y in x.ys">
253+
<li v-for="z in x.zs" :key="z.id">
254+
123
255+
</li>
256+
</template>
247257
</template>
248258
</template>`
249259
}
250-
251260
]
252261
})

0 commit comments

Comments
 (0)