support special fn clamp
This commit is contained in:
parent
eadd7c5041
commit
c6cb7c1d68
@ -278,6 +278,9 @@ impl<'a, 'b> Parser<'a, 'b> {
|
||||
.to_css_string(self.options.is_compressed())?,
|
||||
),
|
||||
},
|
||||
"clamp" if lower == "clamp" => {
|
||||
self.parse_calc_args(&mut s)?;
|
||||
}
|
||||
_ => s.push_str(
|
||||
&self
|
||||
.parse_call_args()?
|
||||
|
@ -4,4 +4,5 @@ pub(crate) fn is_special_function(s: &str) -> bool {
|
||||
|| s.starts_with("env(")
|
||||
|| s.starts_with("min(")
|
||||
|| s.starts_with("max(")
|
||||
|| s.starts_with("clamp(")
|
||||
}
|
||||
|
@ -234,3 +234,23 @@ error!(
|
||||
progid_nothing_after,
|
||||
"a { color: progid:", "Error: expected \"(\"."
|
||||
);
|
||||
test!(
|
||||
clamp_empty_args,
|
||||
"a {\n color: clamp();\n}\n",
|
||||
"a {\n color: clamp();\n}\n"
|
||||
);
|
||||
test!(
|
||||
clamp_parens_in_args,
|
||||
"a {\n color: clamp((()));\n}\n",
|
||||
"a {\n color: clamp((()));\n}\n"
|
||||
);
|
||||
test!(
|
||||
clamp_single_arg,
|
||||
"a {\n color: clamp(1);\n}\n",
|
||||
"a {\n color: clamp(1);\n}\n"
|
||||
);
|
||||
test!(
|
||||
clamp_many_args,
|
||||
"a {\n color: clamp(1, 2, 3);\n}\n",
|
||||
"a {\n color: clamp(1, 2, 3);\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user