handle non-list to nth()
This commit is contained in:
parent
284bc8ea6d
commit
5ce2515fb6
@ -25,7 +25,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
max_args!(args, 2);
|
||||
let list = match arg!(args, 0, "list") {
|
||||
Value::List(v, _) => v,
|
||||
_ => return Err("Missing argument $list.".into()),
|
||||
v => vec![v],
|
||||
};
|
||||
let n = match arg!(args, 1, "n") {
|
||||
Value::Dimension(num, _) => num,
|
||||
|
@ -33,6 +33,11 @@ test!(
|
||||
"a {\n color: nth((a, b, c), 3);\n}\n",
|
||||
"a {\n color: c;\n}\n"
|
||||
);
|
||||
test!(
|
||||
nth_non_list,
|
||||
"a {\n color: nth(foo, 1);\n}\n",
|
||||
"a {\n color: foo;\n}\n"
|
||||
);
|
||||
test!(
|
||||
list_separator_space_separated,
|
||||
"a {\n color: list-separator(a b c);\n}\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user