|
6 | 6 | vModelDynamic,
|
7 | 7 | withDirectives,
|
8 | 8 | VNode,
|
9 |
| - ref, |
10 |
| - reactive |
| 9 | + ref |
11 | 10 | } from '@vue/runtime-dom'
|
12 | 11 |
|
13 | 12 | const triggerEvent = (type: string, el: Element) => {
|
@@ -434,78 +433,6 @@ describe('vModel', () => {
|
434 | 433 | expect(bar.checked).toEqual(false)
|
435 | 434 | })
|
436 | 435 |
|
437 |
| - it(`should support the reactive array in setup as a checkbox model`, async () => { |
438 |
| - const value = reactive<string[]>([]) |
439 |
| - |
440 |
| - const component = defineComponent({ |
441 |
| - setup() { |
442 |
| - return () => { |
443 |
| - return [ |
444 |
| - withVModel( |
445 |
| - h('input', { |
446 |
| - type: 'checkbox', |
447 |
| - class: 'foo', |
448 |
| - value: 'foo', |
449 |
| - 'onUpdate:modelValue': setValue.bind(this) |
450 |
| - }), |
451 |
| - value |
452 |
| - ), |
453 |
| - withVModel( |
454 |
| - h('input', { |
455 |
| - type: 'checkbox', |
456 |
| - class: 'bar', |
457 |
| - value: 'bar', |
458 |
| - 'onUpdate:modelValue': setValue.bind(this) |
459 |
| - }), |
460 |
| - value |
461 |
| - ) |
462 |
| - ] |
463 |
| - } |
464 |
| - } |
465 |
| - }) |
466 |
| - render(h(component), root) |
467 |
| - |
468 |
| - const foo = root.querySelector('.foo') |
469 |
| - const bar = root.querySelector('.bar') |
470 |
| - |
471 |
| - foo.checked = true |
472 |
| - triggerEvent('change', foo) |
473 |
| - await nextTick() |
474 |
| - expect(value).toMatchObject(['foo']) |
475 |
| - |
476 |
| - bar.checked = true |
477 |
| - triggerEvent('change', bar) |
478 |
| - await nextTick() |
479 |
| - expect(value).toMatchObject(['foo', 'bar']) |
480 |
| - |
481 |
| - bar.checked = false |
482 |
| - triggerEvent('change', bar) |
483 |
| - await nextTick() |
484 |
| - expect(value).toMatchObject(['foo']) |
485 |
| - |
486 |
| - foo.checked = false |
487 |
| - triggerEvent('change', foo) |
488 |
| - await nextTick() |
489 |
| - expect(value).toMatchObject([]) |
490 |
| - |
491 |
| - value.length = 0 |
492 |
| - value.push('foo') |
493 |
| - await nextTick() |
494 |
| - expect(bar.checked).toEqual(false) |
495 |
| - expect(foo.checked).toEqual(true) |
496 |
| - |
497 |
| - value.length = 0 |
498 |
| - value.push('bar') |
499 |
| - await nextTick() |
500 |
| - expect(foo.checked).toEqual(false) |
501 |
| - expect(bar.checked).toEqual(true) |
502 |
| - |
503 |
| - value.length = 0 |
504 |
| - await nextTick() |
505 |
| - expect(foo.checked).toEqual(false) |
506 |
| - expect(bar.checked).toEqual(false) |
507 |
| - }) |
508 |
| - |
509 | 436 | it(`should support Set as a checkbox model`, async () => {
|
510 | 437 | const component = defineComponent({
|
511 | 438 | data() {
|
|
0 commit comments