Skip to content

Commit ab94425

Browse files
committed
chore: add some test cases (todo)
1 parent 2bf2b60 commit ab94425

File tree

1 file changed

+64
-40
lines changed

1 file changed

+64
-40
lines changed

packages/runtime-vapor/__tests__/componentProps.spec.ts

+64-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// NOTE: This test is implemented based on the case of `runtime-core/__test__/componentProps.spec.ts`.
22

3+
// NOTE: not supported
4+
// mixins
5+
// caching
6+
37
import { defineComponent } from '../src/apiDefineComponent'
48

59
import type { FunctionalComponent } from '../src/component'
@@ -77,7 +81,7 @@ describe('component props (vapor)', () => {
7781
})
7882

7983
test('stateful with setup', () => {
80-
// FIXME: is it necessary?
84+
// TODO:
8185
})
8286

8387
test('functional with declaration', () => {
@@ -287,7 +291,34 @@ describe('component props (vapor)', () => {
287291
})
288292

289293
test('using inject in default value factory', () => {
290-
// FIXME: is it necessary?
294+
// TODO: impl inject
295+
})
296+
297+
// NOTE: maybe it's unnecessary
298+
// https://github.com/vuejs/core-vapor/pull/99#discussion_r1472647377
299+
test('optimized props updates', async () => {
300+
// TODO:
301+
})
302+
303+
describe('validator', () => {
304+
// TODO: impl validator
305+
})
306+
307+
test('warn props mutation', () => {
308+
// TODO: impl warn
309+
})
310+
311+
test('warn absent required props', () => {
312+
// TODO: impl warn
313+
})
314+
315+
test('warn on type mismatch', () => {
316+
// TODO: impl warn
317+
})
318+
319+
// #3495
320+
test('should not warn required props using kebab-case', async () => {
321+
// TODO: impl warn
291322
})
292323

293324
test('props type support BigInt', () => {
@@ -324,35 +355,35 @@ describe('component props (vapor)', () => {
324355
})
325356

326357
// #3288
327-
// test('declared prop key should be present even if not passed', async () => {
328-
// let initialKeys: string[] = []
329-
// const changeSpy = vi.fn()
330-
// const passFoo = ref(false)
331-
// const Comp = {
332-
// props: ['foo'],
333-
// setup() {
334-
// const instance = getCurrentInstance()!
335-
// initialKeys = Object.keys(instance.props)
336-
// watchEffect(changeSpy)
337-
// return {}
338-
// },
339-
// render() {
340-
// return {}
341-
// },
342-
// }
343-
// const Parent = createIf(
344-
// () => passFoo.value,
345-
// () => {
346-
// return render(Comp , { foo: 1 }, host) // TODO: createComponent fn
347-
// },
348-
// )
349-
// // expect(changeSpy).toHaveBeenCalledTimes(1)
350-
// })
358+
test('declared prop key should be present even if not passed', async () => {
359+
// let initialKeys: string[] = []
360+
// const changeSpy = vi.fn()
361+
// const passFoo = ref(false)
362+
// const Comp = {
363+
// props: ['foo'],
364+
// setup() {
365+
// const instance = getCurrentInstance()!
366+
// initialKeys = Object.keys(instance.props)
367+
// watchEffect(changeSpy)
368+
// return {}
369+
// },
370+
// render() {
371+
// return {}
372+
// },
373+
// }
374+
// const Parent = createIf(
375+
// () => passFoo.value,
376+
// () => {
377+
// return render(Comp , { foo: 1 }, host) // TODO: createComponent fn
378+
// },
379+
// )
380+
// // expect(changeSpy).toHaveBeenCalledTimes(1)
381+
})
351382

352383
// #3371
353-
// test(`avoid double-setting props when casting`, async () => {
354-
// // TODO: proide, slots
355-
// })
384+
test(`avoid double-setting props when casting`, async () => {
385+
// TODO: proide, slots
386+
})
356387

357388
test('support null in required + multiple-type declarations', () => {
358389
const Comp = defineComponent({
@@ -371,10 +402,10 @@ describe('component props (vapor)', () => {
371402
}).not.toThrow()
372403
})
373404

374-
// // #5016
375-
// test('handling attr with undefined value', () => {
376-
// // TODO: attrs
377-
// })
405+
// #5016
406+
test('handling attr with undefined value', () => {
407+
// TODO: attrs
408+
})
378409

379410
// #691ef
380411
test('should not mutate original props long-form definition object', () => {
@@ -392,11 +423,4 @@ describe('component props (vapor)', () => {
392423

393424
expect(Object.keys(props.msg).length).toBe(1)
394425
})
395-
396-
// NOTE: not supported
397-
// optimized props update
398-
// mixins
399-
// validator
400-
// warn
401-
// caching
402426
})

0 commit comments

Comments
 (0)