@@ -189,6 +189,8 @@ describe('compiler v-bind', () => {
189
189
content : `id` ,
190
190
isStatic : false ,
191
191
} ,
192
+ runtimeCamelize : false ,
193
+ modifier : undefined ,
192
194
} )
193
195
194
196
expect ( code ) . matchSnapshot ( )
@@ -207,6 +209,8 @@ describe('compiler v-bind', () => {
207
209
content : `fooBar` ,
208
210
isStatic : false ,
209
211
} ,
212
+ runtimeCamelize : false ,
213
+ modifier : undefined ,
210
214
} )
211
215
212
216
expect ( code ) . matchSnapshot ( )
@@ -220,7 +224,6 @@ describe('compiler v-bind', () => {
220
224
const { ir, code } = compileWithVBind ( `<div v-bind:[foo].camel="id"/>` )
221
225
222
226
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
223
- runtimeCamelize : true ,
224
227
key : {
225
228
content : `foo` ,
226
229
isStatic : false ,
@@ -229,6 +232,8 @@ describe('compiler v-bind', () => {
229
232
content : `id` ,
230
233
isStatic : false ,
231
234
} ,
235
+ runtimeCamelize : true ,
236
+ modifier : undefined ,
232
237
} )
233
238
234
239
expect ( code ) . matchSnapshot ( )
@@ -245,39 +250,41 @@ describe('compiler v-bind', () => {
245
250
246
251
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
247
252
key : {
248
- content : `. fooBar` ,
253
+ content : `fooBar` ,
249
254
isStatic : true ,
250
255
} ,
251
256
value : {
252
257
content : `id` ,
253
258
isStatic : false ,
254
259
} ,
260
+ runtimeCamelize : false ,
261
+ modifier : '.' ,
255
262
} )
256
263
257
264
expect ( code ) . matchSnapshot ( )
258
265
expect ( code ) . contains ( 'renderEffect' )
259
- expect ( code ) . contains ( '_setDynamicProp (n1, ". fooBar", undefined, _ctx.id)' )
266
+ expect ( code ) . contains ( '_setDOMProp (n1, "fooBar", undefined, _ctx.id)' )
260
267
} )
261
268
262
269
test ( '.prop modifier w/ no expression' , ( ) => {
263
270
const { ir, code } = compileWithVBind ( `<div v-bind:fooBar.prop />` )
264
271
265
272
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
266
273
key : {
267
- content : `. fooBar` ,
274
+ content : `fooBar` ,
268
275
isStatic : true ,
269
276
} ,
270
277
value : {
271
278
content : `fooBar` ,
272
279
isStatic : false ,
273
280
} ,
281
+ runtimeCamelize : false ,
282
+ modifier : '.' ,
274
283
} )
275
284
276
285
expect ( code ) . matchSnapshot ( )
277
286
expect ( code ) . contains ( 'renderEffect' )
278
- expect ( code ) . contains (
279
- '_setDynamicProp(n1, ".fooBar", undefined, _ctx.fooBar)' ,
280
- )
287
+ expect ( code ) . contains ( '_setDOMProp(n1, "fooBar", undefined, _ctx.fooBar)' )
281
288
} )
282
289
283
290
test ( '.prop modifier w/ dynamic arg' , ( ) => {
@@ -292,6 +299,8 @@ describe('compiler v-bind', () => {
292
299
content : `id` ,
293
300
isStatic : false ,
294
301
} ,
302
+ runtimeCamelize : false ,
303
+ modifier : '.' ,
295
304
} )
296
305
297
306
expect ( code ) . matchSnapshot ( )
@@ -308,78 +317,82 @@ describe('compiler v-bind', () => {
308
317
309
318
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
310
319
key : {
311
- content : `. fooBar` ,
320
+ content : `fooBar` ,
312
321
isStatic : true ,
313
322
} ,
314
323
value : {
315
324
content : `id` ,
316
325
isStatic : false ,
317
326
} ,
327
+ runtimeCamelize : false ,
328
+ modifier : '.' ,
318
329
} )
319
330
320
331
expect ( code ) . matchSnapshot ( )
321
332
expect ( code ) . contains ( 'renderEffect' )
322
- expect ( code ) . contains ( '_setDynamicProp (n1, ". fooBar", undefined, _ctx.id)' )
333
+ expect ( code ) . contains ( '_setDOMProp (n1, "fooBar", undefined, _ctx.id)' )
323
334
} )
324
335
325
336
test ( '.prop modifier (shortband) w/ no expression' , ( ) => {
326
337
const { ir, code } = compileWithVBind ( `<div .fooBar />` )
327
338
328
339
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
329
340
key : {
330
- content : `. fooBar` ,
341
+ content : `fooBar` ,
331
342
isStatic : true ,
332
343
} ,
333
344
value : {
334
345
content : `fooBar` ,
335
346
isStatic : false ,
336
347
} ,
348
+ runtimeCamelize : false ,
349
+ modifier : '.' ,
337
350
} )
338
351
339
352
expect ( code ) . matchSnapshot ( )
340
353
expect ( code ) . contains ( 'renderEffect' )
341
- expect ( code ) . contains (
342
- '_setDynamicProp(n1, ".fooBar", undefined, _ctx.fooBar)' ,
343
- )
354
+ expect ( code ) . contains ( '_setDOMProp(n1, "fooBar", undefined, _ctx.fooBar)' )
344
355
} )
345
356
346
357
test ( '.attr modifier' , ( ) => {
347
358
const { ir, code } = compileWithVBind ( `<div v-bind:foo-bar.attr="id"/>` )
348
359
349
360
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
350
361
key : {
351
- content : `^ foo-bar` ,
362
+ content : `foo-bar` ,
352
363
isStatic : true ,
353
364
} ,
354
365
value : {
355
366
content : `id` ,
356
367
isStatic : false ,
357
368
} ,
369
+ runtimeCamelize : false ,
370
+ modifier : '^' ,
358
371
} )
359
372
360
373
expect ( code ) . matchSnapshot ( )
361
374
expect ( code ) . contains ( 'renderEffect' )
362
- expect ( code ) . contains ( '_setDynamicProp (n1, "^ foo-bar", undefined, _ctx.id)' )
375
+ expect ( code ) . contains ( '_setAttr (n1, "foo-bar", undefined, _ctx.id)' )
363
376
} )
364
377
365
378
test ( '.attr modifier w/ no expression' , ( ) => {
366
379
const { ir, code } = compileWithVBind ( `<div v-bind:foo-bar.attr />` )
367
380
368
381
expect ( ir . effect [ 0 ] . operations [ 0 ] ) . toMatchObject ( {
369
382
key : {
370
- content : `^ foo-bar` ,
383
+ content : `foo-bar` ,
371
384
isStatic : true ,
372
385
} ,
373
386
value : {
374
387
content : `fooBar` ,
375
388
isStatic : false ,
376
389
} ,
390
+ runtimeCamelize : false ,
391
+ modifier : '^' ,
377
392
} )
378
393
379
394
expect ( code ) . matchSnapshot ( )
380
395
expect ( code ) . contains ( 'renderEffect' )
381
- expect ( code ) . contains (
382
- '_setDynamicProp(n1, "^foo-bar", undefined, _ctx.fooBar)' ,
383
- )
396
+ expect ( code ) . contains ( '_setAttr(n1, "foo-bar", undefined, _ctx.fooBar)' )
384
397
} )
385
398
} )
0 commit comments