Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/core/ui/styling/style-properties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions packages/core/ui/styling/style-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,11 @@ const borderColorProperty = new ShorthandProperty<Style, string | Color>({
}
},
converter: function (value) {
// an empty string resets the colors, like unsetValue
if (value === '') {
value = unsetValue;
}

if (typeof value === 'string') {
const colors = parseBorderColorPositioning(value);

Expand Down
Loading