Skip to content
Closed
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
9 changes: 6 additions & 3 deletions lib/properties/borderSpacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ function parse(v) {
switch (value.length) {
case 1: {
return parsers.resolveNumericValue(value, {
type: "length"
type: "length",
min: 0
});
}
case 2: {
const [part1, part2] = value;
const val1 = parsers.resolveNumericValue([part1], {
type: "length"
type: "length",
min: 0
});
const val2 = parsers.resolveNumericValue([part2], {
type: "length"
type: "length",
min: 0
});
if (val1 && val2) {
return `${val1} ${val2}`;
Expand Down
12 changes: 12 additions & 0 deletions test/properties.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,18 @@ describe("border", () => {
testPropertyValue("border-spacing", "10px 20px", "10px 20px");
});

it("border-spacing should not set / get negative length", () => {
testPropertyValue("border-spacing", "-10px", "");
});

it("border-spacing should not set / get negative length as the first of two values", () => {
testPropertyValue("border-spacing", "-10px 20px", "");
});

it("border-spacing should not set / get negative length as the second of two values", () => {
testPropertyValue("border-spacing", "10px -20px", "");
});

it("border-top shorthand should set / get value", () => {
testImplicitPropertyValue(
"border-top",
Expand Down