test: add more case

This commit is contained in:
daiwei 2024-11-22 14:29:38 +08:00
parent e7ce2974d7
commit 8ce63aa707
1 changed files with 3 additions and 1 deletions

View File

@ -2205,16 +2205,18 @@ describe('SSR hydration', () => {
expect(`Hydration style mismatch`).not.toHaveBeenWarned() expect(`Hydration style mismatch`).not.toHaveBeenWarned()
}) })
test('should not warn on css v-bind non-string & non-number & empty string value', () => { test('style var with falsy values', () => {
const container = document.createElement('div') const container = document.createElement('div')
container.innerHTML = `<div style="padding: 4px;--bar:;"></div>` container.innerHTML = `<div style="padding: 4px;--bar:;"></div>`
const app = createSSRApp({ const app = createSSRApp({
setup() { setup() {
const value1 = ref<any>(null) const value1 = ref<any>(null)
const value2 = ref('') const value2 = ref('')
const value3 = ref<any>(undefined)
useCssVars(() => ({ useCssVars(() => ({
foo: value1.value, foo: value1.value,
bar: value2.value, bar: value2.value,
baz: value3.value,
})) }))
return () => h(Child) return () => h(Child)
}, },