Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhe141 committed Aug 23, 2024
1 parent 5f988c2 commit ad3a8bf
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion packages/runtime-dom/__tests__/patchProps.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { patchProp } from '../src/patchProp'
import { h, nextTick, ref, render } from '../src'
import {
createElementBlock,
guardReactiveProps,
h,
nextTick,
normalizeProps,
reactive,
ref,
render,
toRefs,
} from '../src'

describe('runtime-dom: props patching', () => {
test('basic', () => {
Expand Down Expand Up @@ -351,4 +361,37 @@ describe('runtime-dom: props patching', () => {
expect(el.translate).toBeFalsy()
expect(el.getAttribute('translate')).toBe('no')
})

// #11691
test('should update the color style of the element from red to yellow after a timeout', async () => {
const state = reactive({
obj: {
style: {
color: 'red',
},
},
})
const App = {
setup() {
const { obj } = toRefs(state)
setTimeout(async () => {
state.obj.style.color = 'yellow'
await nextTick()
expect(el.style.color).toBe('yellow')
})
return () => {
return createElementBlock(
'div',
normalizeProps(guardReactiveProps(obj.value)),
'msg',
17,
)
}
},
}
const root = document.createElement('div')
render(h(App), root)
const el = root.children[0] as HTMLSelectElement
expect(el.style.color).toBe('red')
})
})

0 comments on commit ad3a8bf

Please sign in to comment.