MCPcopy
hub / github.com/nuxt/nuxt / createWrappedClientPage

Function createWrappedClientPage

test/nuxt/client-only.test.ts:153–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151})
152
153function createWrappedClientPage () {
154 let resolve: () => void
155 const promise = new Promise<void>((_resolve) => {
156 resolve = _resolve
157 })
158
159 const comp = defineComponent({
160 async setup () {
161 await promise
162 return () => h('div', { id: 'async' }, 'async resolved')
163 },
164 })
165
166 const ClientPage = defineAsyncComponent(() => createClientPage(() => Promise.resolve(comp)))
167
168 const wrapper = mount({
169 setup () {
170 return () => h('div', {}, [
171 h(Suspense, {}, {
172 default: () => h(ClientPage, {}),
173 fallback: () => h('div', { id: 'fallback' }, 'loading'),
174 }),
175 ])
176 },
177 })
178
179 return { resolve: resolve!, wrapper }
180}

Callers 1

Calls 2

createClientPageFunction · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…