Skip to content

Commit fd16a0d

Browse files
committed
add test
1 parent 0deda1a commit fd16a0d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/View/ViewComponentTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Tests\View;
44

55
use Illuminate\View\Component;
6+
use Illuminate\View\ComponentAttributeBag;
67
use PHPUnit\Framework\TestCase;
78

89
class ViewComponentTest extends TestCase
@@ -18,6 +19,15 @@ public function testDataExposure()
1819
$this->assertSame('taylor', $variables['hello']('taylor'));
1920
}
2021

22+
public function testAttributeParentInheritance()
23+
{
24+
$component = new TestViewComponent;
25+
26+
$component->withAttributes(['class' => 'foo', 'attributes' => new ComponentAttributeBag(['class' => 'bar', 'type' => 'button'])]);
27+
28+
$this->assertEquals('class="foo bar" type="button"', (string) $component->attributes);
29+
}
30+
2131
public function testPublicMethodsWithNoArgsAreConvertedToStringableCallablesInvokedAndNotCached()
2232
{
2333
$component = new TestSampleViewComponent;

0 commit comments

Comments
 (0)