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

Function checkWarning

packages/compiler-dom/__tests__/transforms/Transition.spec.ts:4–20  ·  view source on GitHub ↗
(
    template: string,
    shouldWarn: boolean,
    message = `<Transition> expects exactly one child element or component.`,
  )

Source from the content-addressed store, hash-verified

2
3describe('Transition multi children warnings', () => {
4 function checkWarning(
5 template: string,
6 shouldWarn: boolean,
7 message = `<Transition> expects exactly one child element or component.`,
8 ) {
9 const spy = vi.fn()
10 compile(template.trim(), {
11 hoistStatic: true,
12 transformHoist: null,
13 onError: err => {
14 spy(err.message)
15 },
16 })
17
18 if (shouldWarn) expect(spy).toHaveBeenCalledWith(message)
19 else expect(spy).not.toHaveBeenCalled()
20 }
21
22 test('warns if multiple children', () => {
23 checkWarning(

Callers 1

Transition.spec.tsFile · 0.85

Calls 1

compileFunction · 0.90

Tested by

no test coverage detected