mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-28 03:44:19 +08:00
Change the method signature to receive only an array of columns and values
This commit is contained in:
@@ -129,7 +129,7 @@ namespace Livewire\Testing {
|
||||
|
||||
public function searchTable(?string $search = null): static {}
|
||||
|
||||
public function searchTableColumn(array|string $column, ?string $search = null): static {}
|
||||
public function searchTableColumns(array $search): static {}
|
||||
|
||||
public function filterTable(string $name, $data = null): static {}
|
||||
|
||||
|
||||
@@ -430,10 +430,10 @@ class TestsColumns
|
||||
};
|
||||
}
|
||||
|
||||
public function searchTableColumn(): Closure
|
||||
public function searchTableColumns(): Closure
|
||||
{
|
||||
return function (array|string $column, ?string $search = null): static {
|
||||
$this->set('tableColumnSearchQueries', is_array($column) ? $column : [$column => $search]);
|
||||
return function (array $search): static {
|
||||
$this->set('tableColumnSearchQueries', $search);
|
||||
|
||||
return $this;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ it('can search individual column records', function () {
|
||||
$content = $posts->first()->content;
|
||||
|
||||
livewire(PostsTable::class)
|
||||
->searchTableColumn('content', $content)
|
||||
->searchTableColumns(['content' => $content])
|
||||
->assertCanSeeTableRecords($posts->where('content', $content))
|
||||
->assertCanNotSeeTableRecords($posts->where('content', '!=', $content));
|
||||
});
|
||||
@@ -80,7 +80,7 @@ it('can search individual column records with relationship', function () {
|
||||
$authorEmail = $posts->first()->author->email;
|
||||
|
||||
livewire(PostsTable::class)
|
||||
->searchTableColumn('author.email', $authorEmail)
|
||||
->searchTableColumns(['author.email' => $authorEmail])
|
||||
->assertCanSeeTableRecords($posts->where('author.email', $authorEmail))
|
||||
->assertCanNotSeeTableRecords($posts->where('author.email', '!=', $authorEmail));
|
||||
});
|
||||
@@ -92,7 +92,7 @@ it('can search multiple individual columns', function () {
|
||||
$authorEmail = $posts->first()->author->email;
|
||||
|
||||
livewire(PostsTable::class)
|
||||
->searchTableColumn([
|
||||
->searchTableColumns([
|
||||
'content' => $content,
|
||||
'author.email' => $authorEmail,
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user