|
3 | 3 | namespace Rappasoft\LaravelLivewireTables\Tests\Unit\Traits\Helpers; |
4 | 4 |
|
5 | 5 | use Rappasoft\LaravelLivewireTables\Tests\TestCase; |
| 6 | +use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; |
6 | 7 |
|
7 | 8 | final class SearchHelpersTest extends TestCase |
8 | 9 | { |
@@ -148,4 +149,50 @@ public function test_can_trim_whitespace_from_search(): void |
148 | 149 | $this->assertSame(' Anthony ', $this->basicTable->getSearch()); |
149 | 150 |
|
150 | 151 | } |
| 152 | + |
| 153 | + public function test_can_test_all_search_options(): void |
| 154 | + { |
| 155 | + $temp = new class extends PetsTable |
| 156 | + { |
| 157 | + public function resetSearchConfiguration(): self |
| 158 | + { |
| 159 | + $this->searchFilterBlur = null; |
| 160 | + $this->searchFilterDebounce = null; |
| 161 | + $this->searchFilterDefer = null; |
| 162 | + $this->searchFilterLazy = null; |
| 163 | + $this->searchFilterLive = null; |
| 164 | + $this->searchFilterThrottle = null; |
| 165 | + |
| 166 | + return $this; |
| 167 | + } |
| 168 | + }; |
| 169 | + |
| 170 | + $this->assertFalse($temp->hasSearchDebounce()); |
| 171 | + |
| 172 | + $temp->setSearchDebounce(1000); |
| 173 | + |
| 174 | + $this->assertSame('.live.debounce.1000ms', $temp->getSearchOptions()); |
| 175 | + |
| 176 | + $temp->resetSearchConfiguration()->setSearchDefer(); |
| 177 | + |
| 178 | + $this->assertSame('', $temp->getSearchOptions()); |
| 179 | + |
| 180 | + $temp->resetSearchConfiguration()->setSearchLive(); |
| 181 | + |
| 182 | + $this->assertSame('.live', $temp->getSearchOptions()); |
| 183 | + |
| 184 | + $temp->resetSearchConfiguration()->setSearchBlur(); |
| 185 | + |
| 186 | + $this->assertSame('.blur', $temp->getSearchOptions()); |
| 187 | + |
| 188 | + $temp->resetSearchConfiguration()->setSearchLazy(); |
| 189 | + |
| 190 | + $this->assertSame('.live.lazy', $temp->getSearchOptions()); |
| 191 | + |
| 192 | + $temp->resetSearchConfiguration()->setSearchThrottle(599); |
| 193 | + |
| 194 | + $this->assertSame('.live.throttle.599ms', $temp->getSearchOptions()); |
| 195 | + |
| 196 | + |
| 197 | + } |
151 | 198 | } |
0 commit comments