chore: tweaks
ci / test (push) Waiting to run Details
ci / continuous-release (push) Waiting to run Details

This commit is contained in:
daiwei 2025-07-03 16:44:22 +08:00
parent 5f70576c73
commit 000d4d0e4e
3 changed files with 13 additions and 14 deletions

View File

@ -472,6 +472,6 @@ describe('attribute fallthrough', () => {
const root = document.createElement('div') const root = document.createElement('div')
createApp(App).use(vaporInteropPlugin).mount(root) createApp(App).use(vaporInteropPlugin).mount(root)
expect(root.innerHTML).toBe('<div foo="vapor foo" bar="bar"></div>') expect(root.innerHTML).toBe('<div foo="foo" bar="bar"></div>')
}) })
}) })

View File

@ -241,11 +241,14 @@ describe('component: slots', () => {
}), }),
).render() ).render()
// foo has higher priority than bindObj.foo expect(props).toEqual({ foo: 100, baz: 'qux' })
expect(props).toEqual({ foo: 0, baz: 'qux' })
foo.value = 2 foo.value = 2
await nextTick() await nextTick()
expect(props).toEqual({ foo: 100, baz: 'qux' })
delete bindObj.value.foo
await nextTick()
expect(props).toEqual({ foo: 2, baz: 'qux' }) expect(props).toEqual({ foo: 2, baz: 'qux' })
}) })

View File

@ -178,16 +178,6 @@ export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
if (key === '$') return if (key === '$') return
// need special merging behavior for class & style // need special merging behavior for class & style
const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined const merged = key === 'class' || key === 'style' ? ([] as any[]) : undefined
// rawProps has high priority
if (hasOwn(rawProps, key)) {
if (merged) {
merged.push(rawProps[key]())
} else {
return rawProps[key]()
}
}
const dynamicSources = rawProps.$ const dynamicSources = rawProps.$
if (dynamicSources) { if (dynamicSources) {
let i = dynamicSources.length let i = dynamicSources.length
@ -206,7 +196,13 @@ export function getAttrFromRawProps(rawProps: RawProps, key: string): unknown {
} }
} }
} }
if (hasOwn(rawProps, key)) {
if (merged) {
merged.push(rawProps[key]())
} else {
return rawProps[key]()
}
}
if (merged && merged.length) { if (merged && merged.length) {
return merged return merged
} }