Skip to content

Commit e2a7d52

Browse files
authored
Fix casing for camel-cased svg values (#1108)
1 parent bd03210 commit e2a7d52

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26403,6 +26403,8 @@ mod tests {
2640326403

2640426404
#[test]
2640526405
fn test_svg() {
26406+
use crate::properties::svg;
26407+
2640626408
minify_test(".foo { fill: yellow; }", ".foo{fill:#ff0}");
2640726409
minify_test(".foo { fill: url(#foo); }", ".foo{fill:url(#foo)}");
2640826410
minify_test(".foo { fill: url(#foo) none; }", ".foo{fill:url(#foo) none}");
@@ -27231,6 +27233,21 @@ mod tests {
2723127233
..Browsers::default()
2723227234
},
2723327235
);
27236+
27237+
let property =
27238+
Property::parse_string("text-rendering".into(), "geometricPrecision", ParserOptions::default()).unwrap();
27239+
assert_eq!(
27240+
property,
27241+
Property::TextRendering(svg::TextRendering::GeometricPrecision)
27242+
);
27243+
let property =
27244+
Property::parse_string("shape-rendering".into(), "geometricPrecision", ParserOptions::default()).unwrap();
27245+
assert_eq!(
27246+
property,
27247+
Property::ShapeRendering(svg::ShapeRendering::GeometricPrecision)
27248+
);
27249+
let property = Property::parse_string("color-interpolation".into(), "sRGB", ParserOptions::default()).unwrap();
27250+
assert_eq!(property, Property::ColorInterpolation(svg::ColorInterpolation::SRGB));
2723427251
}
2723527252

2723627253
#[test]

src/properties/svg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ pub enum Marker<'i> {
211211

212212
/// A value for the [color-interpolation](https://www.w3.org/TR/SVG2/painting.html#ColorInterpolation) property.
213213
#[derive(Debug, Clone, Copy, PartialEq, Parse, ToCss)]
214+
#[css(case = lower)]
214215
#[cfg_attr(feature = "visitor", derive(Visit))]
215216
#[cfg_attr(
216217
feature = "serde",
@@ -249,6 +250,7 @@ pub enum ColorRendering {
249250

250251
/// A value for the [shape-rendering](https://www.w3.org/TR/SVG2/painting.html#ShapeRendering) property.
251252
#[derive(Debug, Clone, Copy, PartialEq, Parse, ToCss)]
253+
#[css(case = lower)]
252254
#[cfg_attr(feature = "visitor", derive(Visit))]
253255
#[cfg_attr(
254256
feature = "serde",
@@ -270,6 +272,7 @@ pub enum ShapeRendering {
270272

271273
/// A value for the [text-rendering](https://www.w3.org/TR/SVG2/painting.html#TextRendering) property.
272274
#[derive(Debug, Clone, Copy, PartialEq, Parse, ToCss)]
275+
#[css(case = lower)]
273276
#[cfg_attr(feature = "visitor", derive(Visit))]
274277
#[cfg_attr(
275278
feature = "serde",

0 commit comments

Comments
 (0)