From baca8f26cf7177e47cc0a36d43cf2fa6e8d2bea0 Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 16:21:46 +0000 Subject: [PATCH] feat(layout): render empty variant slots Co-Authored-By: Virgil --- layout.go | 3 --- layout_test.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/layout.go b/layout.go index adf9b88..b99e0b1 100644 --- a/layout.go +++ b/layout.go @@ -80,9 +80,6 @@ func (l *Layout) Render(ctx *Context) string { for i := range len(l.variant) { slot := l.variant[i] children := l.slots[slot] - if len(children) == 0 { - continue - } meta, ok := slotRegistry[slot] if !ok { diff --git a/layout_test.go b/layout_test.go index 53532f4..941af3e 100644 --- a/layout_test.go +++ b/layout_test.go @@ -114,3 +114,16 @@ func TestLayout_IgnoresInvalidSlots(t *testing.T) { t.Errorf("C variant should ignore R slot content, got:\n%s", got) } } + +func TestLayout_RendersEmptySlots(t *testing.T) { + ctx := NewContext() + layout := NewLayout("HCF") + + got := layout.Render(ctx) + + for _, want := range []string{`
`, `
`, `
`} { + if !strings.Contains(got, want) { + t.Errorf("empty slot should still render %q in:\n%s", want, got) + } + } +}