Skip to content

Commit 62cf033

Browse files
committed
feat(runtime-dom): add test case
1 parent f2d54d5 commit 62cf033

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

packages/runtime-dom/__tests__/directives/vShow.spec.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,44 @@ describe('runtime-dom: v-show directive', () => {
211211
await nextTick()
212212
expect($div.style.display).toEqual('')
213213
})
214+
215+
// #10151
216+
test('should respect the display value when v-show value is true', async () => {
217+
const isVisible = ref(false)
218+
const compStyle = ref({
219+
display: 'none',
220+
})
221+
222+
const Component = {
223+
setup() {
224+
return () => {
225+
return withVShow(
226+
h('div', { style: compStyle.value }),
227+
isVisible.value,
228+
)
229+
}
230+
},
231+
}
232+
render(h(Component), root)
233+
234+
const $div = root.children[0]
235+
236+
expect($div.style.display).toEqual('none')
237+
238+
isVisible.value = true
239+
await nextTick()
240+
expect($div.style.display).toEqual('none')
241+
242+
compStyle.value.display = 'block'
243+
await nextTick()
244+
expect($div.style.display).toEqual('block')
245+
246+
compStyle.value.display = 'inline-block'
247+
await nextTick()
248+
expect($div.style.display).toEqual('inline-block')
249+
250+
isVisible.value = false
251+
await nextTick()
252+
expect($div.style.display).toEqual('none')
253+
})
214254
})

0 commit comments

Comments
 (0)