diff --git a/src/Folder/Foldable.php b/src/Folder/Foldable.php index 2b2dfa8..4c2f072 100644 --- a/src/Folder/Foldable.php +++ b/src/Folder/Foldable.php @@ -102,19 +102,21 @@ protected function setupSlots(): void foreach ($this->node->children as $child) { if ($child instanceof SlotNode) { - if (! $this->hasActualContent($child->children)) { - continue; - } + $children = []; - $placeholder = 'BLAZE_PLACEHOLDER_' . $this->placeholderIndex++ . '_'; + if ($this->hasActualContent($child->children)) { + $placeholder = 'BLAZE_PLACEHOLDER_' . $this->placeholderIndex++ . '_'; + + $this->slotByPlaceholder[$placeholder] = $child; - $this->slotByPlaceholder[$placeholder] = $child; + $children = [new TextNode($placeholder)]; + } $slots[$child->name] = new SlotNode( name: $child->name, attributeString: $child->attributeString, slotStyle: $child->slotStyle, - children: [new TextNode($placeholder)], + children: $children, prefix: $child->prefix, closeHasName: $child->closeHasName, attributes: $child->attributes, diff --git a/tests/Folder/FoldableTest.php b/tests/Folder/FoldableTest.php index 6ff77c7..fb0549a 100644 --- a/tests/Folder/FoldableTest.php +++ b/tests/Folder/FoldableTest.php @@ -420,13 +420,13 @@ expect($output)->toBe('
'); }); -test('does not synthesize a placeholder for a whitespace-only explicit slot', function () { - $node = app(Parser::class)->parse('