File tree 1 file changed +14
-1
lines changed
packages/runtime-dom/__tests__/directives
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -215,15 +215,23 @@ describe('runtime-dom: v-show directive', () => {
215
215
// #10151
216
216
test ( 'should respect the display value when v-show value is true' , async ( ) => {
217
217
const isVisible = ref ( false )
218
+ const useDisplayStyle = ref ( true )
218
219
const compStyle = ref ( {
219
220
display : 'none' ,
220
221
} )
222
+ const withoutDisplayStyle = {
223
+ margin : '10px' ,
224
+ }
221
225
222
226
const Component = {
223
227
setup ( ) {
224
228
return ( ) => {
225
229
return withVShow (
226
- h ( 'div' , { style : compStyle . value } ) ,
230
+ h ( 'div' , {
231
+ style : useDisplayStyle . value
232
+ ? compStyle . value
233
+ : withoutDisplayStyle ,
234
+ } ) ,
227
235
isVisible . value ,
228
236
)
229
237
}
@@ -247,6 +255,11 @@ describe('runtime-dom: v-show directive', () => {
247
255
await nextTick ( )
248
256
expect ( $div . style . display ) . toEqual ( 'inline-block' )
249
257
258
+ useDisplayStyle . value = false
259
+ await nextTick ( )
260
+ expect ( $div . style . display ) . toEqual ( '' )
261
+ expect ( getComputedStyle ( $div ) . display ) . toEqual ( 'block' )
262
+
250
263
isVisible . value = false
251
264
await nextTick ( )
252
265
expect ( $div . style . display ) . toEqual ( 'none' )
You can’t perform that action at this time.
0 commit comments