Improve alpha/opacity function tests

This commit is contained in:
ConnorSkees 2020-02-08 18:51:29 -05:00
parent 44d257494a
commit bf98382b0b
2 changed files with 10 additions and 1 deletions

View File

@ -44,6 +44,10 @@ impl Display for Number {
break; break;
} }
} }
if frac != BigRational::from_integer(BigInt::from(0)) {
write!(f, "{}", (frac * BigRational::from_integer(BigInt::from(10))).round().to_integer())?;
}
} }
Ok(()) Ok(())
} }

View File

@ -49,5 +49,10 @@ test!(
test!( test!(
alpha_function_4_hex, alpha_function_4_hex,
"a {\n color: alpha(#0123);\n}\n", "a {\n color: alpha(#0123);\n}\n",
"a {\n color: .25;\n}\n" "a {\n color: 0.2;\n}\n"
);
test!(
alpha_function_named_color,
"a {\n color: alpha(red);\n}\n",
"a {\n color: 1;\n}\n"
); );