Skip to content

Commit b82ea91

Browse files
committed
Add fix for View Compnent Column attribute type
1 parent c505525 commit b82ea91

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Unit/Views/Columns/ViewComponentColumnTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,19 @@ public function test_can_not_return_invalid_attributes(): void
9292
$column = ViewComponentColumn::make('Total Users')->component('test-component')->attributes(fn ($value, $row, Column $column) => 'test')->getContents(Pet::find(1));
9393

9494
}
95+
96+
public function test_can_not_return_invalid_attributes_return(): void
97+
{
98+
$this->expectException(DataTableConfigurationException::class);
99+
100+
$column = ViewComponentColumn::make('Total Users')
101+
->customComponent(\Rappasoft\LaravelLivewireTables\Tests\Http\TestComponent::class)
102+
->attributes(fn ($value, $row, Column $column) => (string) 'test');
103+
104+
$contents = $column->getContents(Pet::find(1));
105+
106+
$this->assertSame('<div>2420</div>', $contents);
107+
108+
}
109+
95110
}

0 commit comments

Comments
 (0)