diff --git a/tests/Views/Filters/DateFilterTest.php b/tests/Views/Filters/DateFilterTest.php index f8655affd..380be1537 100644 --- a/tests/Views/Filters/DateFilterTest.php +++ b/tests/Views/Filters/DateFilterTest.php @@ -146,4 +146,14 @@ public function test_can_check_if_can_set_default_values(): void $this->assertSame('2023-03-01', self::$filterInstance->getFilterDefaultValue()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $this->assertSame('livewire-tables::components.tools.filters.date', self::$filterInstance->getViewPath()); + self::$filterInstance->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', self::$filterInstance->getViewPath()); + } } diff --git a/tests/Views/Filters/DateRangeFilterTest.php b/tests/Views/Filters/DateRangeFilterTest.php index 2616ca152..f971baddc 100644 --- a/tests/Views/Filters/DateRangeFilterTest.php +++ b/tests/Views/Filters/DateRangeFilterTest.php @@ -389,6 +389,17 @@ public function can_get_datestring(): void $this->assertSame('2020-01-01 to 2020-02-02', $filter->getDateString(['2020-02-02', '2020-01-01'])); $this->assertSame('2021-03-03 to 2021-04-04', $filter->getDateString(['minDate' => '2021-03-03', 'maxDate' => '2021-04-04'])); $this->assertSame('2022-05-05 to 2022-06-06', $filter->getDateString('2022-05-05,to,2022-06-06')); + } + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $filter = DateRangeFilter::make('Active'); + $this->assertSame('livewire-tables::components.tools.filters.date-range', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); } + } diff --git a/tests/Views/Filters/DateTimeFilterTest.php b/tests/Views/Filters/DateTimeFilterTest.php index 2c2c53951..65c18542e 100644 --- a/tests/Views/Filters/DateTimeFilterTest.php +++ b/tests/Views/Filters/DateTimeFilterTest.php @@ -125,4 +125,15 @@ public function test_can_check_if_can_set_default_values(): void $this->assertSame('2023-01-01T10:00', self::$filterInstance->getFilterDefaultValue()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $this->assertSame('livewire-tables::components.tools.filters.datetime', self::$filterInstance->getViewPath()); + self::$filterInstance->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', self::$filterInstance->getViewPath()); + } + } diff --git a/tests/Views/Filters/FilterTestCase.php b/tests/Views/Filters/FilterTestCase.php index f7ce70d5d..ea9e46108 100644 --- a/tests/Views/Filters/FilterTestCase.php +++ b/tests/Views/Filters/FilterTestCase.php @@ -103,4 +103,14 @@ public function can_check_if_filter_is_reset_by_clear_button(): void $this->assertFalse(self::$filterInstance->isResetByClearButton()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $this->assertSame('livewire-tables::components.tools.filters.date', self::$filterInstance->getViewPath()); + self::$filterInstance->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', self::$filterInstance->getViewPath()); + } } diff --git a/tests/Views/Filters/MultiSelectDropdownFilterTest.php b/tests/Views/Filters/MultiSelectDropdownFilterTest.php index 3c20fdd90..fbb9bb615 100644 --- a/tests/Views/Filters/MultiSelectDropdownFilterTest.php +++ b/tests/Views/Filters/MultiSelectDropdownFilterTest.php @@ -246,4 +246,17 @@ public function test_can_check_if_can_set_default_value(array $optionsArray): vo $this->assertSame(['1', '3'], $filter->getFilterDefaultValue()); } + + /** + * @test + * + * @depends testArraySetup + */ + public function can_set_custom_filter_view(array $optionsArray): void + { + $filter = MultiSelectDropdownFilter::make('BreedID')->options($optionsArray); + $this->assertSame('livewire-tables::components.tools.filters.multi-select-dropdown', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); + } } diff --git a/tests/Views/Filters/MultiSelectFilterTest.php b/tests/Views/Filters/MultiSelectFilterTest.php index c94fb8eda..3a3d89ab4 100644 --- a/tests/Views/Filters/MultiSelectFilterTest.php +++ b/tests/Views/Filters/MultiSelectFilterTest.php @@ -204,4 +204,15 @@ public function can_get_if_filter_empty(): void $this->assertTrue($filter->isEmpty('test')); $this->assertFalse($filter->isEmpty([1])); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $filter = MultiSelectFilter::make('Active'); + $this->assertSame('livewire-tables::components.tools.filters.multi-select', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); + } } diff --git a/tests/Views/Filters/NumberFilterTest.php b/tests/Views/Filters/NumberFilterTest.php index 267893442..87d3c8b34 100644 --- a/tests/Views/Filters/NumberFilterTest.php +++ b/tests/Views/Filters/NumberFilterTest.php @@ -196,4 +196,15 @@ public function test_can_check_if_can_set_default_value(): void $this->assertSame('123', $filter->getFilterDefaultValue()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $filter = NumberFilter::make('Active'); + $this->assertSame('livewire-tables::components.tools.filters.number', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); + } } diff --git a/tests/Views/Filters/NumberRangeFilterTest.php b/tests/Views/Filters/NumberRangeFilterTest.php index 800af3b92..a1719afb4 100644 --- a/tests/Views/Filters/NumberRangeFilterTest.php +++ b/tests/Views/Filters/NumberRangeFilterTest.php @@ -352,4 +352,15 @@ public function can_check_if_filter_is_reset_by_clear_button(): void $this->assertFalse($filter->isResetByClearButton()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $filter = NumberRangeFilter::make('Active'); + $this->assertSame('livewire-tables::components.tools.filters.number-range', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); + } } diff --git a/tests/Views/Filters/SelectFilterTest.php b/tests/Views/Filters/SelectFilterTest.php index 845098452..0d5b4fb6f 100644 --- a/tests/Views/Filters/SelectFilterTest.php +++ b/tests/Views/Filters/SelectFilterTest.php @@ -81,4 +81,14 @@ public function test_can_check_if_can_set_default_value(): void $this->assertSame('1', self::$filterInstance->getFilterDefaultValue()); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $this->assertSame('livewire-tables::components.tools.filters.select', self::$filterInstance->getViewPath()); + self::$filterInstance->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', self::$filterInstance->getViewPath()); + } } diff --git a/tests/Views/Filters/TextFilterTest.php b/tests/Views/Filters/TextFilterTest.php index 41f1e8d6d..4f4044f6e 100644 --- a/tests/Views/Filters/TextFilterTest.php +++ b/tests/Views/Filters/TextFilterTest.php @@ -59,4 +59,16 @@ public function can_get_if_text_filter_empty(): void $this->assertFalse($filter->isEmpty('123')); $this->assertFalse($filter->isEmpty('test')); } + + /** + * @test + */ + public function can_set_custom_filter_view(): void + { + $filter = TextFilter::make('Active'); + + $this->assertSame('livewire-tables::components.tools.filters.text-field', $filter->getViewPath()); + $filter->setCustomView('test-custom-filter-view'); + $this->assertSame('test-custom-filter-view', $filter->getViewPath()); + } }