|
|
@@ -1,13 +1,5 @@
|
|
|
-import {
|
|
|
- createFor,
|
|
|
- nextTick,
|
|
|
- ref,
|
|
|
- renderEffect,
|
|
|
- shallowRef,
|
|
|
- template,
|
|
|
- triggerRef,
|
|
|
- withDestructure,
|
|
|
-} from '../src'
|
|
|
+import { createFor, renderEffect } from '../src'
|
|
|
+import { nextTick, ref, shallowRef, triggerRef } from '@vue/runtime-dom'
|
|
|
import { makeRender } from './_utils'
|
|
|
|
|
|
const define = makeRender()
|
|
|
@@ -582,26 +574,24 @@ describe.todo('createFor', () => {
|
|
|
expectCalledTimesToBe('Clear rows', 1, 0, 0, 0)
|
|
|
})
|
|
|
|
|
|
- test('withDestructure', () => {
|
|
|
- const list = ref([{ name: 'a' }, { name: 'b' }, { name: 'c' }])
|
|
|
-
|
|
|
- const { host } = define(() => {
|
|
|
- const n1 = createFor(
|
|
|
- () => list.value,
|
|
|
- withDestructure(
|
|
|
- ([{ name }, index]) => [name, index],
|
|
|
- ctx => {
|
|
|
- const span = template(`<li>${ctx[1]}. ${ctx[0]}</li>`)()
|
|
|
- return span
|
|
|
- },
|
|
|
- ),
|
|
|
- item => item.name,
|
|
|
- )
|
|
|
- return n1
|
|
|
- }).render()
|
|
|
-
|
|
|
- expect(host.innerHTML).toBe(
|
|
|
- '<li>0. a</li><li>1. b</li><li>2. c</li><!--for-->',
|
|
|
- )
|
|
|
+ test.todo('withDestructure', () => {
|
|
|
+ // const list = ref([{ name: 'a' }, { name: 'b' }, { name: 'c' }])
|
|
|
+ // const { host } = define(() => {
|
|
|
+ // const n1 = createFor(
|
|
|
+ // () => list.value,
|
|
|
+ // withDestructure(
|
|
|
+ // ([{ name }, index]) => [name, index],
|
|
|
+ // ctx => {
|
|
|
+ // const span = template(`<li>${ctx[1]}. ${ctx[0]}</li>`)()
|
|
|
+ // return span
|
|
|
+ // },
|
|
|
+ // ),
|
|
|
+ // item => item.name,
|
|
|
+ // )
|
|
|
+ // return n1
|
|
|
+ // }).render()
|
|
|
+ // expect(host.innerHTML).toBe(
|
|
|
+ // '<li>0. a</li><li>1. b</li><li>2. c</li><!--for-->',
|
|
|
+ // )
|
|
|
})
|
|
|
})
|