Skip to content

Commit db7ba7c

Browse files
committed
Test Tweaks
1 parent 40ffa73 commit db7ba7c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/Unit/DataTransferObjects/FilterPillDataTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Rappasoft\LaravelLivewireTables\Tests\Unit\DataTransferObjects;
44

5+
use Illuminate\View\ComponentAttributeBag;
56
use Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData;
67
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
78

@@ -145,4 +146,40 @@ public function test_can_get_custom_pill_blade()
145146
$dto = FilterPillData::make($filterPillTitle, $filterSelectName, $filterPillValue, $separator, $isAnExternalLivewireFilter, $hasCustomPillBlade, $customPillBlade, $filterPillsItemAttributes);
146147
$this->assertSame($dto->getCustomPillBlade(), $customPillBlade);
147148
}
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+
148185
}

0 commit comments

Comments
 (0)