Skip to content

Commit 888d953

Browse files
authored
test(hydration): force hydrate custom element with dynamic props (#14102)
1 parent 092c73a commit 888d953

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
createPlainElement,
23
createVaporSSRApp,
34
defineVaporAsyncComponent,
45
delegateEvents,
@@ -4031,8 +4032,26 @@ describe('Vapor Mode hydration', () => {
40314032
expect((container.firstChild! as any).foo).toBe(true)
40324033
})
40334034

4034-
// vapor custom element not implemented yet
4035-
test.todo('force hydrate custom element with dynamic props', () => {})
4035+
test('force hydrate custom element with dynamic props', () => {
4036+
class MyElement extends HTMLElement {
4037+
foo = ''
4038+
constructor() {
4039+
super()
4040+
}
4041+
}
4042+
customElements.define('my-element-7203', MyElement)
4043+
4044+
const msg = ref('bar')
4045+
const container = document.createElement('div')
4046+
container.innerHTML = '<my-element-7203></my-element-7203>'
4047+
const app = createVaporSSRApp({
4048+
setup() {
4049+
return createPlainElement('my-element-7203', { foo: () => msg.value })
4050+
},
4051+
})
4052+
app.mount(container)
4053+
expect((container.firstChild as any).foo).toBe(msg.value)
4054+
})
40364055
})
40374056
})
40384057

0 commit comments

Comments
 (0)