fix(runtime-dom): fix behavior regression for v-show + style display binding

fix #4768
This commit is contained in:
Evan You
2021-10-09 19:31:52 -04:00
parent 3ca83179d1
commit 3f38d599f5
2 changed files with 25 additions and 14 deletions

View File

@@ -68,6 +68,14 @@ describe(`runtime-dom: style patching`, () => {
expect(el.style.width).toBe('0px')
})
it('should remove style attribute on falsy value', () => {
const el = document.createElement('div')
el.style.cssText = 'color: red;'
patchProp(el as any, 'style', {}, null)
expect(el.hasAttribute('style')).toBe(false)
expect(el.style.cssText).toBe('')
})
// JSDOM doesn't support custom properties on style object so we have to
// mock it here.
function mockElementWithStyle() {