MCPcopy
hub / github.com/vuejs/core / factory

Function factory

packages/runtime-core/__tests__/helpers/useId.spec.ts:77–93  ·  view source on GitHub ↗
(
      delay1: number,
      delay2: number,
    )

Source from the content-addressed store, hash-verified

75
76 test('async component', async () => {
77 const factory = (
78 delay1: number,
79 delay2: number,
80 ): ReturnType<TestCaseFactory> => {
81 const p1 = promiseWithDelay(BasicComponentWithUseId, delay1)
82 const p2 = promiseWithDelay(BasicComponentWithUseId, delay2)
83 const AsyncOne = defineAsyncComponent(() => p1)
84 const AsyncTwo = defineAsyncComponent(() => p2)
85 const app = createApp({
86 setup() {
87 const id1 = useId()
88 const id2 = useId()
89 return () => [id1, ' ', id2, ' ', h(AsyncOne), ' ', h(AsyncTwo)]
90 },
91 })
92 return [app, [p1, p2]]
93 }
94
95 const expected =
96 'v-0 v-1 ' + // root

Callers 4

constructorMethod · 0.85
runOnClientFunction · 0.85
runOnServerFunction · 0.85
useId.spec.tsFile · 0.85

Calls 4

promiseWithDelayFunction · 0.85
defineComponentFunction · 0.85
resolveMethod · 0.65
defineAsyncComponentFunction · 0.50

Tested by

no test coverage detected