Skip to content

Commit 7408feb

Browse files
authored
test(no-deprecated-v-bind-sync): make tests more strict (#2883)
1 parent 06ab7a9 commit 7408feb

File tree

1 file changed

+144
-18
lines changed

1 file changed

+144
-18
lines changed

tests/lib/rules/no-deprecated-v-bind-sync.js

Lines changed: 144 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,55 +37,104 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
3737
code: "<template><MyComponent v-bind:foo.sync='bar'/></template>",
3838
output: "<template><MyComponent v-model:foo='bar'/></template>",
3939
errors: [
40-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
40+
{
41+
message:
42+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
43+
line: 1,
44+
column: 24,
45+
endLine: 1,
46+
endColumn: 45
47+
}
4148
]
4249
},
4350
{
4451
filename: 'test.vue',
4552
code: "<template><MyComponent :foo.sync='bar'/></template>",
4653
output: "<template><MyComponent v-model:foo='bar'/></template>",
4754
errors: [
48-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
55+
{
56+
message:
57+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
58+
line: 1,
59+
column: 24,
60+
endLine: 1,
61+
endColumn: 39
62+
}
4963
]
5064
},
5165
{
5266
filename: 'test.vue',
5367
code: "<template><MyComponent v-bind:[dynamicArg].sync='bar'/></template>",
5468
output: "<template><MyComponent v-model:[dynamicArg]='bar'/></template>",
5569
errors: [
56-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
70+
{
71+
message:
72+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
73+
line: 1,
74+
column: 24,
75+
endLine: 1,
76+
endColumn: 54
77+
}
5778
]
5879
},
5980
{
6081
filename: 'test.vue',
6182
code: "<template><MyComponent :[dynamicArg].sync='bar'/></template>",
6283
output: "<template><MyComponent v-model:[dynamicArg]='bar'/></template>",
6384
errors: [
64-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
85+
{
86+
message:
87+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
88+
line: 1,
89+
column: 24,
90+
endLine: 1,
91+
endColumn: 48
92+
}
6593
]
6694
},
6795
{
6896
filename: 'test.vue',
6997
code: "<template><MyComponent v-bind.sync='bar'/></template>",
7098
output: null,
7199
errors: [
72-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
100+
{
101+
message:
102+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
103+
line: 1,
104+
column: 24,
105+
endLine: 1,
106+
endColumn: 41
107+
}
73108
]
74109
},
75110
{
76111
filename: 'test.vue',
77112
code: '<template><MyComponent :foo.sync.unknown="foo" /></template>',
78113
output: null,
79114
errors: [
80-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
115+
{
116+
message:
117+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
118+
line: 1,
119+
column: 24,
120+
endLine: 1,
121+
endColumn: 47
122+
}
81123
]
82124
},
83125
{
84126
filename: 'test.vue',
85127
code: '<template><MyComponent :[dynamicArg].sync.unknown="foo" /></template>',
86128
output: null,
87129
errors: [
88-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
130+
{
131+
message:
132+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
133+
line: 1,
134+
column: 24,
135+
endLine: 1,
136+
endColumn: 56
137+
}
89138
]
90139
},
91140
{
@@ -94,7 +143,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
94143
output:
95144
'<template><div><div v-for="x in list"><MyComponent v-model:foo="x.foo" /></div></div></template>',
96145
errors: [
97-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
146+
{
147+
message:
148+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
149+
line: 1,
150+
column: 52,
151+
endLine: 1,
152+
endColumn: 69
153+
}
98154
]
99155
},
100156
{
@@ -103,7 +159,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
103159
output:
104160
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x]" /></div></div></template>',
105161
errors: [
106-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
162+
{
163+
message:
164+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
165+
line: 1,
166+
column: 52,
167+
endLine: 1,
168+
endColumn: 70
169+
}
107170
]
108171
},
109172
{
@@ -112,7 +175,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
112175
output:
113176
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x - 1]" /></div></div></template>',
114177
errors: [
115-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
178+
{
179+
message:
180+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
181+
line: 1,
182+
column: 52,
183+
endLine: 1,
184+
endColumn: 74
185+
}
116186
]
117187
},
118188
{
@@ -121,7 +191,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
121191
output:
122192
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[`${x}`]" /></div></div></template>',
123193
errors: [
124-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
194+
{
195+
message:
196+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
197+
line: 1,
198+
column: 52,
199+
endLine: 1,
200+
endColumn: 75
201+
}
125202
]
126203
},
127204
{
@@ -130,7 +207,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
130207
output:
131208
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[`prefix_${x}`]" /></div></div></template>',
132209
errors: [
133-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
210+
{
211+
message:
212+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
213+
line: 1,
214+
column: 52,
215+
endLine: 1,
216+
endColumn: 82
217+
}
134218
]
135219
},
136220
{
@@ -139,7 +223,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
139223
output:
140224
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x ? x : \'_\']" /></div></div></template>',
141225
errors: [
142-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
226+
{
227+
message:
228+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
229+
line: 1,
230+
column: 52,
231+
endLine: 1,
232+
endColumn: 80
233+
}
143234
]
144235
},
145236
{
@@ -148,7 +239,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
148239
output:
149240
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x || \'_\']" /></div></div></template>',
150241
errors: [
151-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
242+
{
243+
message:
244+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
245+
line: 1,
246+
column: 52,
247+
endLine: 1,
248+
endColumn: 77
249+
}
152250
]
153251
},
154252
{
@@ -157,7 +255,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
157255
output:
158256
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x()]" /></div></div></template>',
159257
errors: [
160-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
258+
{
259+
message:
260+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
261+
line: 1,
262+
column: 52,
263+
endLine: 1,
264+
endColumn: 72
265+
}
161266
]
162267
},
163268
{
@@ -166,7 +271,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
166271
output:
167272
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[/r/.match(x) ? 0 : 1]" /></div></div></template>',
168273
errors: [
169-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
274+
{
275+
message:
276+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
277+
line: 1,
278+
column: 52,
279+
endLine: 1,
280+
endColumn: 89
281+
}
170282
]
171283
},
172284
{
@@ -175,7 +287,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
175287
output:
176288
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[typeof x]" /></div></div></template>',
177289
errors: [
178-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
290+
{
291+
message:
292+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
293+
line: 1,
294+
column: 52,
295+
endLine: 1,
296+
endColumn: 77
297+
}
179298
]
180299
},
181300
{
@@ -184,7 +303,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
184303
output:
185304
'<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[tag`${x}`]" /></div></div></template>',
186305
errors: [
187-
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead."
306+
{
307+
message:
308+
"'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.",
309+
line: 1,
310+
column: 52,
311+
endLine: 1,
312+
endColumn: 78
313+
}
188314
]
189315
}
190316
]

0 commit comments

Comments
 (0)