@@ -30,83 +30,124 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, {
30
30
{
31
31
filename : 'test.vue' ,
32
32
code : "<template><MyComponent :foo='bar'/></template>"
33
+ } ,
34
+ {
35
+ filename : 'test.vue' ,
36
+ code : "<template><MyComponent v-bind:[dynamicArg]='bar'/></template>"
37
+ } ,
38
+ {
39
+ filename : 'test.vue' ,
40
+ code : "<template><MyComponent :[dynamicArg]='bar'/></template>"
33
41
}
34
42
] ,
35
43
36
44
invalid : [
37
45
{
38
46
filename : 'test.vue' ,
39
47
code : "<template><MyComponent v-bind:foo.sync='bar'/></template>" ,
48
+ output : "<template><MyComponent v-model:foo='bar'/></template>" ,
40
49
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
41
50
} ,
42
51
{
43
52
filename : 'test.vue' ,
44
53
code : "<template><MyComponent :foo.sync='bar'/></template>" ,
54
+ output : "<template><MyComponent v-model:foo='bar'/></template>" ,
55
+ errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
56
+ } ,
57
+ {
58
+ filename : 'test.vue' ,
59
+ code : "<template><MyComponent v-bind:[dynamicArg].sync='bar'/></template>" ,
60
+ output : "<template><MyComponent v-model:[dynamicArg]='bar'/></template>" ,
61
+ errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
62
+ } ,
63
+ {
64
+ filename : 'test.vue' ,
65
+ code : "<template><MyComponent :[dynamicArg].sync='bar'/></template>" ,
66
+ output : "<template><MyComponent v-model:[dynamicArg]='bar'/></template>" ,
45
67
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
46
68
} ,
47
69
{
48
70
filename : 'test.vue' ,
49
71
code : "<template><MyComponent v-bind.sync='bar'/></template>" ,
72
+ output : "<template><MyComponent v-bind.sync='bar'/></template>" ,
50
73
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
51
74
} ,
52
75
{
53
76
filename : 'test.vue' ,
54
77
code : '<template><MyComponent :foo.sync.unknown="foo" /></template>' ,
78
+ output : '<template><MyComponent :foo.sync.unknown="foo" /></template>' ,
79
+ errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
80
+ } ,
81
+ {
82
+ filename : 'test.vue' ,
83
+ code : '<template><MyComponent :[dynamicArg].sync.unknown="foo" /></template>' ,
84
+ output : '<template><MyComponent :[dynamicArg].sync.unknown="foo" /></template>' ,
55
85
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
56
86
} ,
57
87
{
58
88
filename : 'test.vue' ,
59
89
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="x.foo" /></div></div></template>' ,
90
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="x.foo" /></div></div></template>' ,
60
91
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
61
92
} ,
62
93
{
63
94
filename : 'test.vue' ,
64
95
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[x]" /></div></div></template>' ,
96
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x]" /></div></div></template>' ,
65
97
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
66
98
} ,
67
99
{
68
100
filename : 'test.vue' ,
69
101
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[x - 1]" /></div></div></template>' ,
102
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x - 1]" /></div></div></template>' ,
70
103
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
71
104
} ,
72
105
{
73
106
filename : 'test.vue' ,
74
107
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[`${x}`]" /></div></div></template>' ,
108
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[`${x}`]" /></div></div></template>' ,
75
109
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
76
110
} ,
77
111
{
78
112
filename : 'test.vue' ,
79
113
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[`prefix_${x}`]" /></div></div></template>' ,
114
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[`prefix_${x}`]" /></div></div></template>' ,
80
115
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
81
116
} ,
82
117
{
83
118
filename : 'test.vue' ,
84
119
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[x ? x : \'_\']" /></div></div></template>' ,
120
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x ? x : \'_\']" /></div></div></template>' ,
85
121
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
86
122
} ,
87
123
{
88
124
filename : 'test.vue' ,
89
125
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[x || \'_\']" /></div></div></template>' ,
126
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x || \'_\']" /></div></div></template>' ,
90
127
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
91
128
} ,
92
129
{
93
130
filename : 'test.vue' ,
94
131
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[x()]" /></div></div></template>' ,
132
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[x()]" /></div></div></template>' ,
95
133
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
96
134
} ,
97
135
{
98
136
filename : 'test.vue' ,
99
137
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[/r/.match(x) ? 0 : 1]" /></div></div></template>' ,
138
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[/r/.match(x) ? 0 : 1]" /></div></div></template>' ,
100
139
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
101
140
} ,
102
141
{
103
142
filename : 'test.vue' ,
104
143
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[typeof x]" /></div></div></template>' ,
144
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[typeof x]" /></div></div></template>' ,
105
145
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
106
146
} ,
107
147
{
108
148
filename : 'test.vue' ,
109
149
code : '<template><div><div v-for="x in list"><MyComponent :foo.sync="foo[tag`${x}`]" /></div></div></template>' ,
150
+ output : '<template><div><div v-for="x in list"><MyComponent v-model:foo="foo[tag`${x}`]" /></div></div></template>' ,
110
151
errors : [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ]
111
152
}
112
153
]
0 commit comments