(
template: string,
shouldWarn: boolean,
message = `<Transition> expects exactly one child element or component.`,
)
| 2 | |
| 3 | describe('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( |
no test coverage detected