From 9510748eed55184b21d49e1efa7b4e38cbae6834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 24 Mar 2024 20:28:41 +0800 Subject: [PATCH] chore: update --- .../__tests__/componentSlots.spec.ts | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/packages/runtime-vapor/__tests__/componentSlots.spec.ts b/packages/runtime-vapor/__tests__/componentSlots.spec.ts index d0252f57c..ec8788060 100644 --- a/packages/runtime-vapor/__tests__/componentSlots.spec.ts +++ b/packages/runtime-vapor/__tests__/componentSlots.spec.ts @@ -12,44 +12,42 @@ import { import { makeRender } from './_utils' const define = makeRender() +function renderWithSlots(slots: any): any { + let instance: any + const Comp = defineComponent({ + render() { + const t0 = template('
') + const n0 = t0() + instance = getCurrentInstance() + return n0 + }, + }) -describe('component: slots', () => { - function renderWithSlots(slots: any): any { - let instance: any - const Comp = defineComponent({ - vapor: true, - render() { - const t0 = template('
') - const n0 = t0() - instance = getCurrentInstance() - return n0 - }, - }) - - const { render } = define({ - render() { - return createComponent(Comp, {}, slots) - }, - }) + const { render } = define({ + render() { + return createComponent(Comp, {}, slots) + }, + }) - render() - return instance - } + render() + return instance +} +describe('component: slots', () => { test('initSlots: instance.slots should be set correctly', () => { const { slots } = renderWithSlots({ _: 1 }) expect(slots).toMatchObject({ _: 1 }) }) // NOTE: slot normalization is not supported - // test.todo( - // 'initSlots: should normalize object slots (when value is null, string, array)', - // () => {}, - // ) - // test.todo( - // 'initSlots: should normalize object slots (when value is function)', - // () => {}, - // ) + test.todo( + 'initSlots: should normalize object slots (when value is null, string, array)', + () => {}, + ) + test.todo( + 'initSlots: should normalize object slots (when value is function)', + () => {}, + ) test('initSlots: instance.slots should be set correctly', () => { let instance: any