|
2 | 2 |
|
3 | 3 | namespace Rappasoft\LaravelLivewireTables\Tests\Unit\DataTransferObjects; |
4 | 4 |
|
| 5 | +use Illuminate\View\ComponentAttributeBag; |
5 | 6 | use Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData; |
6 | 7 | use Rappasoft\LaravelLivewireTables\Tests\TestCase; |
7 | 8 |
|
@@ -145,4 +146,40 @@ public function test_can_get_custom_pill_blade() |
145 | 146 | $dto = FilterPillData::make($filterPillTitle, $filterSelectName, $filterPillValue, $separator, $isAnExternalLivewireFilter, $hasCustomPillBlade, $customPillBlade, $filterPillsItemAttributes); |
146 | 147 | $this->assertSame($dto->getCustomPillBlade(), $customPillBlade); |
147 | 148 | } |
| 149 | + |
| 150 | + |
| 151 | + public function test_can_get_filter_pill_display_data_html() |
| 152 | + { |
| 153 | + $filterPillTitle = 'filterPillTitle'; |
| 154 | + $filterSelectName = 'filterSelectName'; |
| 155 | + $filterPillValue = 'filterPillValue'; |
| 156 | + $separator = ' , '; |
| 157 | + $isAnExternalLivewireFilter = true; |
| 158 | + $hasCustomPillBlade = true; |
| 159 | + $customPillBlade = 'test-blade'; |
| 160 | + $filterPillsItemAttributes = ['default' => true, 'default-colors' => true, 'default-styling' => true]; |
| 161 | + $dto = FilterPillData::make($filterPillTitle, $filterSelectName, $filterPillValue, $separator, $isAnExternalLivewireFilter, $hasCustomPillBlade, $customPillBlade, $filterPillsItemAttributes, '', true, false, []); |
| 162 | + $displayData = $dto->getExternalFilterPillDisplayData(); |
| 163 | + $bag = new ComponentAttributeBag(['x-html' => 'displayString']); |
| 164 | + |
| 165 | + $this->assertSame($displayData->getAttributes(), $bag->getAttributes()); |
| 166 | + } |
| 167 | + |
| 168 | + public function test_can_get_filter_pill_display_data_non_html() |
| 169 | + { |
| 170 | + $filterPillTitle = 'filterPillTitle'; |
| 171 | + $filterSelectName = 'filterSelectName'; |
| 172 | + $filterPillValue = 'filterPillValue'; |
| 173 | + $separator = ' , '; |
| 174 | + $isAnExternalLivewireFilter = false; |
| 175 | + $hasCustomPillBlade = true; |
| 176 | + $customPillBlade = 'test-blade'; |
| 177 | + $filterPillsItemAttributes = ['default' => true, 'default-colors' => true, 'default-styling' => true]; |
| 178 | + $dto = FilterPillData::make($filterPillTitle, $filterSelectName, $filterPillValue, $separator, $isAnExternalLivewireFilter, $hasCustomPillBlade, $customPillBlade, $filterPillsItemAttributes); |
| 179 | + $displayData = $dto->getExternalFilterPillDisplayData(); |
| 180 | + $bag = new ComponentAttributeBag(['x-text' => 'displayString']); |
| 181 | + |
| 182 | + $this->assertSame($displayData->getAttributes(), $bag->getAttributes()); |
| 183 | + } |
| 184 | + |
148 | 185 | } |
0 commit comments