Skip to content

Commit 47e5c8c

Browse files
committed
Minor Tweaks to Tests
1 parent b894077 commit 47e5c8c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/Unit/Views/Filters/FilterTestCase.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PHPUnit\Framework\Attributes\Group;
66
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
7+
use Illuminate\View\ComponentAttributeBag;
78

89
#[Group('Filters')]
910
abstract class FilterTestCase extends TestCase
@@ -154,6 +155,47 @@ public function test_can_set_custom_input_attributes(): void
154155
}
155156

156157
$this->assertSame($standardAttributes, $currentAttributeBag);
158+
}
159+
160+
public function test_can_get_custom_pill_attributes(): void
161+
{
162+
$filter = self::$filterInstance;
163+
164+
$attributes = array_merge(['default-colors' => true, 'default-styling' => true], []);
165+
ksort($attributes);
166+
167+
$this->assertSame($attributes, $filter->getPillAttributes());
168+
169+
}
170+
171+
public function test_can_set_custom_pill_attributes(): void
172+
{
173+
$filter = self::$filterInstance;
174+
175+
$attributes = array_merge(['default-colors' => true, 'default-styling' => true], []);
176+
ksort($attributes);
177+
178+
$this->assertSame($attributes, $filter->getPillAttributes());
179+
180+
$attributes = array_merge(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true], []);
181+
ksort($attributes);
182+
183+
$filter->setPillAttributes(['class' => 'bg-red-500']);
184+
185+
$this->assertSame($attributes, $filter->getPillAttributes());
186+
187+
188+
}
189+
190+
public function test_can_set_custom_pill_attributes_bag(): void
191+
{
192+
$attributes = array_merge(['class' => 'bg-red-500', 'default-colors' => true, 'default-styling' => true], []);
193+
ksort($attributes);
194+
$filter = self::$filterInstance;
195+
$filter->setPillAttributes(['class' => 'bg-red-500']);
196+
$this->assertSame(new ComponentAttributeBag($attributes)->getAttributes(), $filter->getPillAttributesBag()->getAttributes());
157197

158198
}
199+
200+
159201
}

0 commit comments

Comments
 (0)