@@ -75,6 +75,38 @@ tester.run('valid-v-model', rule, {
7575 filename : 'test.vue' ,
7676 code : '<template><div><div v-for="x in list"><input v-model="foo[x - 1]"></div></div></template>'
7777 } ,
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+ } ,
78110 {
79111 filename : 'test.vue' ,
80112 code : '<template><input :type="a" v-model="b"></template>'
@@ -119,6 +151,16 @@ tester.run('valid-v-model', rule, {
119151 filename : 'test.vue' ,
120152 code : '<template><div><div v-for="x in list"><input v-model="x"></div></div></template>' ,
121153 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." ]
122164 }
123165 ]
124166} )
0 commit comments