File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 33namespace Illuminate \Tests \View ;
44
55use Illuminate \View \Component ;
6+ use Illuminate \View \ComponentAttributeBag ;
67use PHPUnit \Framework \TestCase ;
78
89class 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 ;
You can’t perform that action at this time.
0 commit comments