|
4 | 4 |
|
5 | 5 | use PHPUnit\Framework\Attributes\Group; |
6 | 6 | use Rappasoft\LaravelLivewireTables\Tests\TestCase; |
| 7 | +use Illuminate\View\ComponentAttributeBag; |
7 | 8 |
|
8 | 9 | #[Group('Filters')] |
9 | 10 | abstract class FilterTestCase extends TestCase |
@@ -154,6 +155,47 @@ public function test_can_set_custom_input_attributes(): void |
154 | 155 | } |
155 | 156 |
|
156 | 157 | $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()); |
157 | 197 |
|
158 | 198 | } |
| 199 | + |
| 200 | + |
159 | 201 | } |
0 commit comments