@@ -75,6 +75,38 @@ tester.run('valid-v-model', rule, {
75
75
filename: 'test.vue',
76
76
code: '<template><div><div v-for="x in list"><input v-model="foo[x - 1]"></div></div></template>'
77
77
},
78
+ {
79
+ filename: 'test.vue',
80
+ code: '<template><div><div v-for="x in list"><input v-model="foo[`${x}`]"></div></div></template>'
81
+ },
82
+ {
83
+ filename: 'test.vue',
84
+ code: '<template><div><div v-for="x in list"><input v-model="foo[`prefix_${x}`]"></div></div></template>'
85
+ },
86
+ {
87
+ filename: 'test.vue',
88
+ code: '<template><div><div v-for="x in list"><input v-model="foo[x ? x : \'_\']"></div></div></template>'
89
+ },
90
+ {
91
+ filename: 'test.vue',
92
+ code: '<template><div><div v-for="x in list"><input v-model="foo[x || \'_\']"></div></div></template>'
93
+ },
94
+ {
95
+ filename: 'test.vue',
96
+ code: '<template><div><div v-for="x in list"><input v-model="foo[x()]"></div></div></template>'
97
+ },
98
+ {
99
+ filename: 'test.vue',
100
+ code: '<template><div><div v-for="x in list"><input v-model="foo[/r/.match(x) ? 0 : 1]"></div></div></template>'
101
+ },
102
+ {
103
+ filename: 'test.vue',
104
+ code: '<template><div><div v-for="x in list"><input v-model="foo[typeof x]"></div></div></template>'
105
+ },
106
+ {
107
+ filename: 'test.vue',
108
+ code: '<template><div><div v-for="x in list"><input v-model="foo[tag`${x}`]"></div></div></template>'
109
+ },
78
110
{
79
111
filename: 'test.vue',
80
112
code: '<template><input :type="a" v-model="b"></template>'
@@ -119,6 +151,16 @@ tester.run('valid-v-model', rule, {
119
151
filename: 'test.vue',
120
152
code: '<template><div><div v-for="x in list"><input v-model="x"></div></div></template>',
121
153
errors: ["'v-model' directives cannot update the iteration variable 'x' itself."]
154
+ },
155
+ {
156
+ filename: 'test.vue',
157
+ code: '<template><div><div v-for="x in list"><input v-model="(x)"></div></div></template>',
158
+ errors: ["'v-model' directives cannot update the iteration variable 'x' itself."]
159
+ },
160
+ {
161
+ filename: 'test.vue',
162
+ code: '<template><div><div v-for="x in list"><input v-model="(((x)))"></div></div></template>',
163
+ errors: ["'v-model' directives cannot update the iteration variable 'x' itself."]
122
164
}
123
165
]
124
166
})
0 commit comments