Skip to content

Commit 9d04c5d

Browse files
authored
chore: add more attr() test (#1127)
Closes: #1126
1 parent 9cff098 commit 9d04c5d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/lib.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23076,6 +23076,34 @@ mod tests {
2307623076
".foo{width:attr(data-width type(<length>), 100px)}",
2307723077
);
2307823078

23079+
minify_test(
23080+
".foo { width: attr( data-foo % ); }",
23081+
".foo{width:attr(data-foo %)}",
23082+
);
23083+
23084+
// <attr-args> = attr( <declaration-value>, <declaration-value>? )
23085+
// Like var(), a bare comma can be used with nothing following it, indicating that the second <declaration-value> was passed, just as an empty sequence.
23086+
// Spec: https://drafts.csswg.org/css-values-5/#funcdef-attr
23087+
minify_test(
23088+
".foo { width: attr( data-foo %, ); }",
23089+
".foo{width:attr(data-foo %,)}",
23090+
);
23091+
23092+
minify_test(
23093+
".foo { width: attr( data-foo px ); }",
23094+
".foo{width:attr(data-foo px)}",
23095+
);
23096+
23097+
minify_test(
23098+
".foo { width: attr(data-foo number ); }",
23099+
".foo{width:attr(data-foo number)}",
23100+
);
23101+
23102+
minify_test(
23103+
".foo { width: attr(data-foo raw-string); }",
23104+
".foo{width:attr(data-foo raw-string)}",
23105+
);
23106+
2307923107
// Test attr() function with type() syntax - non-minified (issue with extra spaces)
2308023108
test(
2308123109
".foo { background-color: attr(data-color type(<color>)); }",

0 commit comments

Comments
 (0)