From: daiwei Date: Thu, 27 Nov 2025 02:42:43 +0000 (+0800) Subject: test: update directive handling to use withVaporDirectives and improve type safety X-Git-Tag: v3.6.0-alpha.6~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1706a6fbfe3461e161d2a6469801383eb8b53e55;p=thirdparty%2Fvuejs%2Fcore.git test: update directive handling to use withVaporDirectives and improve type safety --- diff --git a/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts b/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts index 82da77b620..01aa7dc32b 100644 --- a/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts +++ b/packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts @@ -1,10 +1,11 @@ import { + type VaporDirective, createComponent, createTextNode, createVaporApp, defineVaporComponent, - // @ts-expect-error - withDirectives, + template, + withVaporDirectives, } from '../src' import { type GenericComponentInstance, @@ -158,18 +159,17 @@ describe('api: createVaporApp', () => { expect(host.innerHTML).toBe(`foobar!barbaz!`) }) - test.todo('directive', () => { + test('directive', () => { const spy1 = vi.fn() const spy2 = vi.fn() const { app, mount } = define({ setup() { - const FooBar = resolveDirective('foo-bar') - const BarBaz = resolveDirective('bar-baz') - return withDirectives(document.createElement('div'), [ - [FooBar], - [BarBaz], - ]) + const FooBar = resolveDirective('foo-bar') as VaporDirective + const BarBaz = resolveDirective('bar-baz') as VaporDirective + const n0 = template('
')() as Element + withVaporDirectives(n0, [[FooBar], [BarBaz]]) + return n0 }, }).create()