Skip to content
Merged
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
25 changes: 25 additions & 0 deletions tests/Unit/Traits/Helpers/ColumnHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Rappasoft\LaravelLivewireTables\Tests\Unit\Traits\Helpers;

use Rappasoft\LaravelLivewireTables\Exceptions\NoColumnsException;
use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable;
use Rappasoft\LaravelLivewireTables\Tests\Models\Pet;
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
use Rappasoft\LaravelLivewireTables\Views\Column;
Expand Down Expand Up @@ -360,4 +362,27 @@ public function test_can_check_if_column_label_has_attributes(): void
$this->assertSame(['class' => 'text-xl', 'default' => true, 'default-colors' => false, 'default-styling' => false], $column->getLabelAttributes());

}

public function test_throws_error_if_no_columns_are_defined(): void
{
$this->expectException(NoColumnsException::class);

$testTable = new class extends PetsTable
{
public function columns(): array
{
return [];
}
};

$testTable->configure();
$testTable->boot();
$testTable->bootedComponentUtilities();
$testTable->bootedWithData();
$testTable->bootedWithColumns();
$testTable->bootedWithColumnSelect();
$testTable->bootedWithSecondaryHeader();
$testTable->booted();

}
}
Loading