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

Function baseCheckWarn

packages/runtime-core/__tests__/components/Suspense.spec.ts:2813–2834  ·  view source on GitHub ↗
(
      shouldWarn: boolean,
      children: RawSlots,
      props: SuspenseProps | null = null,
    )

Source from the content-addressed store, hash-verified

2811 describe('warnings', () => {
2812 // base function to check if a combination of slots warns or not
2813 function baseCheckWarn(
2814 shouldWarn: boolean,
2815 children: RawSlots,
2816 props: SuspenseProps | null = null,
2817 ) {
2818 const Comp = {
2819 setup() {
2820 return () => h(Suspense, props, children)
2821 },
2822 }
2823
2824 const root = nodeOps.createElement('div')
2825 render(h(Comp), root)
2826
2827 if (shouldWarn) {
2828 expect(`<Suspense> slots expect a single root node.`).toHaveBeenWarned()
2829 } else {
2830 expect(
2831 `<Suspense> slots expect a single root node.`,
2832 ).not.toHaveBeenWarned()
2833 }
2834 }
2835
2836 // actual function that we use in tests
2837 const checkWarn = baseCheckWarn.bind(null, true)

Callers

nothing calls this directly

Calls 4

renderFunction · 0.90
hFunction · 0.85
createElementMethod · 0.80
toHaveBeenWarnedMethod · 0.80

Tested by

no test coverage detected