fix: merge multiple class attributes into single attribute
- codegen.zig: collect class values and output as single merged attribute - template.zig: respect quoted flag to prevent data lookup for static class values - Added tests for multiple class merging scenarios
This commit is contained in:
@@ -202,6 +202,18 @@ test "Implicit div with ID" {
|
||||
try expectOutput("#content", .{}, "<div id=\"content\"></div>");
|
||||
}
|
||||
|
||||
test "Multiple classes merged into single attribute" {
|
||||
try expectOutput("div.foo.bar.baz", .{}, "<div class=\"foo bar baz\"></div>");
|
||||
}
|
||||
|
||||
test "Multiple classes with text" {
|
||||
try expectOutput(".a.b hello", .{}, "<div class=\"a b\">hello</div>");
|
||||
}
|
||||
|
||||
test "Class attribute merged with shorthand classes" {
|
||||
try expectOutput("div(class=\"foo\").bar.baz", .{}, "<div class=\"foo bar baz\"></div>");
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Test Case 10: &attributes spread operator
|
||||
// TODO: &attributes spread with JS object literal not yet implemented
|
||||
|
||||
Reference in New Issue
Block a user