Skip to content

Commit c81ffad

Browse files
committed
fix attributes
1 parent 0b12ef1 commit c81ffad

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

Diff for: src/Illuminate/View/Component.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function withAttributes(array $attributes)
218218
{
219219
$this->attributes = $this->attributes ?: new ComponentAttributeBag;
220220

221-
$this->attributes = $this->attributes->merge($attributes);
221+
$this->attributes->setAttributes($attributes);
222222

223223
return $this;
224224
}

Diff for: tests/View/ViewComponentTest.php

-11
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ public function testMethodsOverridePropertyValues()
7070
$this->assertArrayHasKey('world', $variables);
7171
$this->assertEquals('world property', $variables['world']);
7272
}
73-
74-
public function testAttributesAreMergedNotOverwritten()
75-
{
76-
$component = new TestDefaultAttributesComponent;
77-
78-
$this->assertEquals('text-red-500', $component->attributes->get('class'));
79-
80-
$component->withAttributes(['class' => 'bg-blue-100']);
81-
82-
$this->assertEquals('bg-blue-100 text-red-500', $component->attributes->get('class'));
83-
}
8473
}
8574

8675
class TestViewComponent extends Component

0 commit comments

Comments
 (0)