Skip to content

Commit 1706a6f

Browse files
committed
test: update directive handling to use withVaporDirectives and improve type safety
1 parent 35068c1 commit 1706a6f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/runtime-vapor/__tests__/apiCreateVaporApp.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {
2+
type VaporDirective,
23
createComponent,
34
createTextNode,
45
createVaporApp,
56
defineVaporComponent,
6-
// @ts-expect-error
7-
withDirectives,
7+
template,
8+
withVaporDirectives,
89
} from '../src'
910
import {
1011
type GenericComponentInstance,
@@ -158,18 +159,17 @@ describe('api: createVaporApp', () => {
158159
expect(host.innerHTML).toBe(`foobar!barbaz!`)
159160
})
160161

161-
test.todo('directive', () => {
162+
test('directive', () => {
162163
const spy1 = vi.fn()
163164
const spy2 = vi.fn()
164165

165166
const { app, mount } = define({
166167
setup() {
167-
const FooBar = resolveDirective('foo-bar')
168-
const BarBaz = resolveDirective('bar-baz')
169-
return withDirectives(document.createElement('div'), [
170-
[FooBar],
171-
[BarBaz],
172-
])
168+
const FooBar = resolveDirective('foo-bar') as VaporDirective
169+
const BarBaz = resolveDirective('bar-baz') as VaporDirective
170+
const n0 = template('<div></div>')() as Element
171+
withVaporDirectives(n0, [[FooBar], [BarBaz]])
172+
return n0
173173
},
174174
}).create()
175175

0 commit comments

Comments
 (0)