Skip to content

Commit

Permalink
Fix serializing currentColor
Browse files Browse the repository at this point in the history
Fixes #408
  • Loading branch information
devongovett committed Feb 12, 2023
1 parent f9ed30f commit fcf4127
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions node/test/visitor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -944,4 +944,23 @@ test('supports returning raw values as variables', () => {
assert.equal(res.code.toString(), '.EgL3uq_foo{color:var(--EgL3uq_foo)}');
});

test('works with currentColor', () => {
let res = transform({
filename: 'test.css',
minify: true,
code: Buffer.from(`
.foo {
color: currentColor;
}
`),
visitor: {
Rule(rule) {
return rule;
}
}
});

assert.equal(res.code.toString(), '.foo{color:currentColor}');
});

test.run();
2 changes: 1 addition & 1 deletion src/values/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl CurrentColor {
where
S: serde::Serializer,
{
serializer.serialize_str("currentcolor")
serde::Serialize::serialize(&CurrentColor::CurrentColor, serializer)
}

fn deserialize<'de, D>(deserializer: D) -> Result<(), D::Error>
Expand Down

0 comments on commit fcf4127

Please sign in to comment.