expect(el.style.getPropertyValue('--custom')).toBe('100\\;')
})
+ it('shorthand properties', () => {
+ const el = document.createElement('div')
+ patchProp(
+ el as any,
+ 'style',
+ { borderBottom: '1px solid red' },
+ { border: '1px solid green' }
+ )
+ expect(el.style.border).toBe('1px solid green')
+ expect(el.style.borderBottom).toBe('1px solid green')
+ })
+
// JSDOM doesn't support custom properties on style object so we have to
// mock it here.
function mockElementWithStyle() {
const style = (el as HTMLElement).style
const isCssString = isString(next)
if (next && !isCssString) {
- for (const key in next) {
- setStyle(style, key, next[key])
- }
if (prev && !isString(prev)) {
for (const key in prev) {
if (next[key] == null) {
}
}
}
+ for (const key in next) {
+ setStyle(style, key, next[key])
+ }
} else {
const currentDisplay = style.display
if (isCssString) {