test('unmount async wrapper before load (fragment)', async () => {})
})
- describe.todo('force hydrate prop', async () => {
- test.todo('force hydrate prop with `.prop` modifier', () => {})
+ describe('force hydrate prop', async () => {
+ test('force hydrate prop with `.prop` modifier', async () => {
+ const { container } = await mountWithHydration(
+ '<input type="checkbox">',
+ `<input type="checkbox" .indeterminate="true"/>`,
+ )
+ expect((container.firstChild! as any).indeterminate).toBe(true)
+ })
- test.todo(
- 'force hydrate input v-model with non-string value bindings',
- () => {},
- )
+ test('force hydrate input v-model with non-string value bindings', async () => {
+ const { container } = await mountWithHydration(
+ '<input type="checkbox" value="true">',
+ `<input type="checkbox" :true-value="true"/>`,
+ )
+ expect((container.firstChild as any)._trueValue).toBe(true)
+ })
- test.todo('force hydrate checkbox with indeterminate', () => {})
+ test.todo('force hydrate checkbox with indeterminate', async () => {
+ const { container } = await mountWithHydration(
+ '<input type="checkbox" indeterminate/>',
+ `<input type="checkbox" :indeterminate="true"/>`,
+ )
+ expect((container.firstChild! as any).indeterminate).toBe(true)
+ })
test.todo(
'force hydrate select option with non-string value bindings',
if (
(__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) &&
isHydrating &&
- !attributeHasMismatch(el, key, value)
+ !attributeHasMismatch(el, key, value) &&
+ !shouldForcePatch(el, key)
) {
return
}
}
return value
}
+
+function shouldForcePatch(el: Element, key: string): boolean {
+ const { tagName } = el
+ const forcePatch = tagName === 'INPUT' || tagName === 'OPTION'
+ return forcePatch && (key.endsWith('value') || key === 'indeterminate')
+}