chore: remove duplicated test + add missing prop decl
This commit is contained in:
parent
3cfe5f9fc8
commit
439377b220
@ -231,6 +231,7 @@ describe('api: lifecycle hooks', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Mid = {
|
const Mid = {
|
||||||
|
props: ['count'],
|
||||||
setup(props: any) {
|
setup(props: any) {
|
||||||
onBeforeMount(() => calls.push('mid onBeforeMount'))
|
onBeforeMount(() => calls.push('mid onBeforeMount'))
|
||||||
onMounted(() => calls.push('mid onMounted'))
|
onMounted(() => calls.push('mid onMounted'))
|
||||||
@ -243,6 +244,7 @@ describe('api: lifecycle hooks', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Child = {
|
const Child = {
|
||||||
|
props: ['count'],
|
||||||
setup(props: any) {
|
setup(props: any) {
|
||||||
onBeforeMount(() => calls.push('child onBeforeMount'))
|
onBeforeMount(() => calls.push('child onBeforeMount'))
|
||||||
onMounted(() => calls.push('child onMounted'))
|
onMounted(() => calls.push('child onMounted'))
|
||||||
|
@ -75,39 +75,6 @@ describe('api: setup context', () => {
|
|||||||
expect(dummy).toBe(1)
|
expect(dummy).toBe(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setup props should resolve the correct types from props object', async () => {
|
|
||||||
const count = ref(0)
|
|
||||||
let dummy
|
|
||||||
|
|
||||||
const Parent = {
|
|
||||||
render: () => h(Child, { count: count.value })
|
|
||||||
}
|
|
||||||
|
|
||||||
const Child = defineComponent({
|
|
||||||
props: {
|
|
||||||
count: Number
|
|
||||||
},
|
|
||||||
|
|
||||||
setup(props) {
|
|
||||||
watchEffect(() => {
|
|
||||||
dummy = props.count
|
|
||||||
})
|
|
||||||
return () => h('div', props.count)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const root = nodeOps.createElement('div')
|
|
||||||
render(h(Parent), root)
|
|
||||||
expect(serializeInner(root)).toMatch(`<div>0</div>`)
|
|
||||||
expect(dummy).toBe(0)
|
|
||||||
|
|
||||||
// props should be reactive
|
|
||||||
count.value++
|
|
||||||
await nextTick()
|
|
||||||
expect(serializeInner(root)).toMatch(`<div>1</div>`)
|
|
||||||
expect(dummy).toBe(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('context.attrs', async () => {
|
it('context.attrs', async () => {
|
||||||
const toggle = ref(true)
|
const toggle = ref(true)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user