File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/runtime-dom/__tests__/directives Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,32 @@ describe('runtime-dom: v-show directive', () => {
151151 expect ( $div . style . display ) . toEqual ( '' )
152152 } )
153153
154+ test ( 'the value of `display` set by v-show should not be overwritten by the style attribute when updated (object value)' , async ( ) => {
155+ const style = ref ( {
156+ display : 'block' ,
157+ width : '100px' ,
158+ } )
159+ const display = ref ( false )
160+ const component = defineComponent ( {
161+ render ( ) {
162+ return withVShow ( h ( 'div' , { style : style . value } ) , display . value )
163+ } ,
164+ } )
165+ render ( h ( component ) , root )
166+
167+ const $div = root . children [ 0 ]
168+
169+ expect ( $div . style . display ) . toEqual ( 'none' )
170+
171+ style . value . width = '50px'
172+ await nextTick ( )
173+ expect ( $div . style . display ) . toEqual ( 'none' )
174+
175+ display . value = true
176+ await nextTick ( )
177+ expect ( $div . style . display ) . toEqual ( 'block' )
178+ } )
179+
154180 // #2583, #2757
155181 test ( 'the value of `display` set by v-show should not be overwritten by the style attribute when updated (with Transition)' , async ( ) => {
156182 const style = ref ( 'width: 100px' )
You can’t perform that action at this time.
0 commit comments