-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
tests/Traits/Visuals/Columns/IncrementColumnVisualsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Visuals\Columns; | ||
|
||
use Exception; | ||
use Illuminate\View\ViewException; | ||
use Livewire\Livewire; | ||
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; | ||
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\FailingTables\{BrokenSecondaryHeaderTable, NoBuildMethodTable, NoPrimaryKeyTable}; | ||
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\{PetsTable,PetsTableAttributes}; | ||
use Rappasoft\LaravelLivewireTables\Tests\TestCase; | ||
|
||
final class IncrementColumnVisualsTest extends TestCase | ||
{ | ||
private $testErrors; | ||
|
||
/* | ||
public function test_increment_column_renders_correctly(): void | ||
{ | ||
Livewire::test(new class extends PetsTable | ||
{ | ||
public function configure(): void | ||
{ | ||
$this->setPrimaryKey('id'); | ||
} | ||
public function columns(): array | ||
{ | ||
return [ | ||
\Rappasoft\LaravelLivewireTables\Views\Columns\IncrementColumn::make('#'), | ||
\Rappasoft\LaravelLivewireTables\Views\Column::make('Name')->searchable(), | ||
]; | ||
} | ||
public function filters(): array | ||
{ | ||
return []; | ||
} | ||
}) | ||
->assertSeeHtmlInOrder([ | ||
'<tr rowpk="1"', | ||
'<td', | ||
'<div>1</div>', | ||
]); | ||
}*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Rappasoft\LaravelLivewireTables\Tests\Views\Columns; | ||
|
||
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; | ||
use Rappasoft\LaravelLivewireTables\Tests\Models\Pet; | ||
use Rappasoft\LaravelLivewireTables\Tests\TestCase; | ||
use Rappasoft\LaravelLivewireTables\Views\Columns\IncrementColumn; | ||
|
||
final class IncrementColumnTest extends TestCase | ||
{ | ||
public function test_can_set_the_column_title(): void | ||
{ | ||
$column = IncrementColumn::make('Name', 'name'); | ||
|
||
$this->assertSame('Name', $column->getTitle()); | ||
} | ||
|
||
public function test_can_not_infer_field_name_from_title_if_no_from(): void | ||
{ | ||
$column = IncrementColumn::make('My Title'); | ||
|
||
$this->assertNull($column->getField()); | ||
} | ||
|
||
public function test_can_not_render_field_if_no_title(): void | ||
{ | ||
$this->expectException(\ArgumentCountError::class); | ||
|
||
IncrementColumn::make()->getContents(Pet::find(1)); | ||
} | ||
|
||
public function test_renders_correctly(): void | ||
{ | ||
$rows = $this->basicTable->getRows(); | ||
$row1 = $rows->first(); | ||
|
||
} | ||
|
||
} |