Skip to content

Commit 7bc3171

Browse files
authored
Fix extraneous trailing space for border property (parcel-bundler#138)
If just color, or color and style for a border were ommited, an extraneous space char would be present at the end of the property value output. This commit fixes this by inserting spaces before values rather than after.
1 parent b210549 commit 7bc3171

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,29 @@ mod tests {
759759
"#},
760760
);
761761

762+
test(
763+
r#"
764+
.foo {
765+
border: 1px solid currentColor;
766+
}
767+
"#,
768+
indoc! {r#"
769+
.foo {
770+
border: 1px solid;
771+
}
772+
"#
773+
},
774+
);
775+
776+
minify_test(
777+
r#"
778+
.foo {
779+
border: 1px solid currentColor;
780+
}
781+
"#,
782+
".foo{border:1px solid}",
783+
);
784+
762785
prefix_test(
763786
r#"
764787
.foo {

src/properties/border.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ impl<S: ToCss + Default + PartialEq> ToCss for GenericBorder<S> {
162162

163163
if self.width != BorderSideWidth::default() {
164164
self.width.to_css(dest)?;
165-
dest.write_str(" ")?;
166165
}
167166
if self.style != S::default() {
168-
self.style.to_css(dest)?;
169167
dest.write_str(" ")?;
168+
self.style.to_css(dest)?;
170169
}
171170
if self.color != CssColor::current_color() {
171+
dest.write_str(" ")?;
172172
self.color.to_css(dest)?;
173173
}
174174
Ok(())

0 commit comments

Comments
 (0)