Skip to content

Commit 45e2ccc

Browse files
authored
Add Initial Tests
1 parent d7bb75f commit 45e2ccc

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Visuals\Columns;
4+
5+
use Exception;
6+
use Illuminate\View\ViewException;
7+
use Livewire\Livewire;
8+
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException;
9+
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\FailingTables\{BrokenSecondaryHeaderTable, NoBuildMethodTable, NoPrimaryKeyTable};
10+
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\{PetsTable,PetsTableAttributes};
11+
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
12+
13+
final class IncrementColumnVisualsTest extends TestCase
14+
{
15+
private $testErrors;
16+
17+
/*
18+
public function test_increment_column_renders_correctly(): void
19+
{
20+
Livewire::test(new class extends PetsTable
21+
{
22+
public function configure(): void
23+
{
24+
$this->setPrimaryKey('id');
25+
}
26+
27+
public function columns(): array
28+
{
29+
return [
30+
\Rappasoft\LaravelLivewireTables\Views\Columns\IncrementColumn::make('#'),
31+
\Rappasoft\LaravelLivewireTables\Views\Column::make('Name')->searchable(),
32+
];
33+
}
34+
35+
public function filters(): array
36+
{
37+
return [];
38+
}
39+
})
40+
->assertSeeHtmlInOrder([
41+
'<tr rowpk="1"',
42+
'<td',
43+
'<div>1</div>',
44+
]);
45+
}*/
46+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Tests\Views\Columns;
4+
5+
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException;
6+
use Rappasoft\LaravelLivewireTables\Tests\Models\Pet;
7+
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
8+
use Rappasoft\LaravelLivewireTables\Views\Columns\IncrementColumn;
9+
10+
final class IncrementColumnTest extends TestCase
11+
{
12+
public function test_can_set_the_column_title(): void
13+
{
14+
$column = IncrementColumn::make('Name', 'name');
15+
16+
$this->assertSame('Name', $column->getTitle());
17+
}
18+
19+
public function test_can_not_infer_field_name_from_title_if_no_from(): void
20+
{
21+
$column = IncrementColumn::make('My Title');
22+
23+
$this->assertNull($column->getField());
24+
}
25+
26+
public function test_can_not_render_field_if_no_title(): void
27+
{
28+
$this->expectException(\ArgumentCountError::class);
29+
30+
IncrementColumn::make()->getContents(Pet::find(1));
31+
}
32+
33+
public function test_renders_correctly(): void
34+
{
35+
$rows = $this->basicTable->getRows();
36+
$row1 = $rows->first();
37+
38+
}
39+
40+
}

0 commit comments

Comments
 (0)