Skip to content

Commit 2397b97

Browse files
committed
Add space after component closing tag
1 parent ec7d5b8 commit 2397b97

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/Illuminate/View/Compilers/ComponentTagCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ protected function compileSelfClosingTags(string $value)
149149

150150
$attributes = $this->getAttributesFromAttributeString($matches['attributes']);
151151

152-
return $this->componentString($matches[1], $attributes)."\n@endcomponentClass";
152+
return $this->componentString($matches[1], $attributes)."\n@endcomponentClass ";
153153
}, $value);
154154
}
155155

tests/View/Blade/BladeComponentTagCompilerTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public function testBasicComponentParsing()
3131

3232
$this->assertSame("<div> @component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
3333
<?php \$component->withAttributes(['type' => 'foo','limit' => '5','@click' => 'foo','required' => true]); ?>
34-
@endcomponentClass @component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
34+
@endcomponentClass @component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
3535
<?php \$component->withAttributes([]); ?>
36-
@endcomponentClass</div>", trim($result));
36+
@endcomponentClass </div>", trim($result));
3737
}
3838

3939
public function testBasicComponentWithEmptyAttributesParsing()
@@ -42,7 +42,7 @@ public function testBasicComponentWithEmptyAttributesParsing()
4242

4343
$this->assertSame("<div> @component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
4444
<?php \$component->withAttributes(['type' => '','limit' => '','@click' => '','required' => true]); ?>
45-
@endcomponentClass</div>", trim($result));
45+
@endcomponentClass </div>", trim($result));
4646
}
4747

4848
public function testDataCamelCasing()
@@ -91,7 +91,7 @@ public function testSelfClosingComponentsCanBeCompiled()
9191

9292
$this->assertSame("<div> @component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
9393
<?php \$component->withAttributes([]); ?>
94-
@endcomponentClass</div>", trim($result));
94+
@endcomponentClass </div>", trim($result));
9595
}
9696

9797
public function testClassNamesCanBeGuessed()
@@ -140,6 +140,15 @@ public function testSelfClosingComponentsCanBeCompiledWithDataAndAttributes()
140140
@endcomponentClass", trim($result));
141141
}
142142

143+
public function testSelfClosingComponentsCanHaveAttachedWord()
144+
{
145+
$result = (new ComponentTagCompiler(['alert' => TestAlertComponent::class]))->compileTags('<x-alert/>Words');
146+
147+
$this->assertSame("@component('Illuminate\Tests\View\Blade\TestAlertComponent', [])
148+
<?php \$component->withAttributes([]); ?>
149+
@endcomponentClass Words", trim($result));
150+
}
151+
143152
public function testSelfClosingComponentsCanBeCompiledWithBoundData()
144153
{
145154
$result = (new ComponentTagCompiler(['alert' => TestAlertComponent::class]))->compileTags('<x-alert :title="$title" class="bar" />');

0 commit comments

Comments
 (0)