File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
packages/runtime-dom/__tests__/directives Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -211,4 +211,44 @@ describe('runtime-dom: v-show directive', () => {
211
211
await nextTick ( )
212
212
expect ( $div . style . display ) . toEqual ( '' )
213
213
} )
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
+ } )
214
254
} )
You can’t perform that action at this time.
0 commit comments