diff --git a/packages/core/ui/styling/style-properties.spec.ts b/packages/core/ui/styling/style-properties.spec.ts index 252e25a3e9..4d0bd6e267 100644 --- a/packages/core/ui/styling/style-properties.spec.ts +++ b/packages/core/ui/styling/style-properties.spec.ts @@ -27,6 +27,19 @@ describe('border-color shorthand', () => { expect(label.style.borderLeftColor).toEqual(new Color('color-mix(in srgb, red 35%, blue)')); }); + it('resets the colors on an empty value', () => { + const label = new Label(); + label.style.borderColor = 'red' as any; + + expect(() => { + label.style.borderColor = '' as any; + }).not.toThrow(); + expect(label.style.borderTopColor).toBeUndefined(); + expect(label.style.borderRightColor).toBeUndefined(); + expect(label.style.borderBottomColor).toBeUndefined(); + expect(label.style.borderLeftColor).toBeUndefined(); + }); + it('still accepts comma-separated colors', () => { const label = new Label(); label.style.borderColor = 'red,blue' as any; diff --git a/packages/core/ui/styling/style-properties.ts b/packages/core/ui/styling/style-properties.ts index cf089b304e..8ac4bc93e5 100644 --- a/packages/core/ui/styling/style-properties.ts +++ b/packages/core/ui/styling/style-properties.ts @@ -772,6 +772,11 @@ const borderColorProperty = new ShorthandProperty({ } }, converter: function (value) { + // an empty string resets the colors, like unsetValue + if (value === '') { + value = unsetValue; + } + if (typeof value === 'string') { const colors = parseBorderColorPositioning(value);