Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Utilities/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ public function columnKeyword(int $index): string
protected function prepareKeyword(float|array|int|string $keyword): string
{
if (is_array($keyword)) {
return implode(' ', $keyword);
$keyword = implode(' ', $keyword);
}

return (string) $keyword;
return e((string) $keyword);
}

/**
Expand Down
25 changes: 25 additions & 0 deletions tests/Integration/QueryDataTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,31 @@ public function it_can_perform_global_search()
]);
}

/** @test */
public function it_can_perform_global_search_with_html_string()
{
User::create([
'name' => e('Record & 21'),
'email' => '[email protected]',
]);

$this->assertEquals('Record & 21', User::find(21)->name);

$crawler = $this->call('GET', '/query/users', [
'columns' => [
['data' => 'name', 'name' => 'name', 'searchable' => 'true', 'orderable' => 'true'],
['data' => 'email', 'name' => 'email', 'searchable' => 'true', 'orderable' => 'true'],
],
'search' => ['value' => 'Record & 21'],
]);

$crawler->assertJson([
'draw' => 0,
'recordsTotal' => 21,
'recordsFiltered' => 1,
]);
}

/** @test */
public function it_can_skip_total_records_count_query()
{
Expand Down