-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportEditorColumnSearchTest.php
More file actions
52 lines (41 loc) · 1.64 KB
/
ReportEditorColumnSearchTest.php
File metadata and controls
52 lines (41 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use ACTTraining\QueryBuilder\Support\Concerns\WithReportBuilder;
it('has enableColumnSearch property defaulting to true on WithReportBuilder trait', function () {
$trait = new class
{
use WithReportBuilder;
};
expect($trait->enableColumnSearch)->toBeTrue();
});
it('report editor view contains the column search markup', function () {
$viewContent = file_get_contents(
__DIR__.'/../resources/views/report-editor.blade.php'
);
expect($viewContent)
->toContain('x-model="search"')
->toContain('placeholder="Search columns..."')
->toContain('enableColumnSearch')
->toContain("search: ''");
});
it('report editor view wraps search input in enableColumnSearch conditional', function () {
$viewContent = file_get_contents(
__DIR__.'/../resources/views/report-editor.blade.php'
);
expect($viewContent)
->toContain('@if($this->enableColumnSearch)')
->toContain('.toLowerCase().includes(search.toLowerCase())');
});
it('report editor view adds x-show filtering to individual column checkboxes', function () {
$viewContent = file_get_contents(
__DIR__.'/../resources/views/report-editor.blade.php'
);
expect($viewContent)
->toContain("x-show=\"'{{ e(\$column['label']) }}'.toLowerCase().includes(search.toLowerCase())\"");
});
it('report editor view adds x-show filtering to section wrappers', function () {
$viewContent = file_get_contents(
__DIR__.'/../resources/views/report-editor.blade.php'
);
expect($viewContent)
->toContain('.some(label => label.toLowerCase().includes(search.toLowerCase()))');
});