Testing a TextInputColumn

Given I have a TextInputColumn. I want to test inputing values and other behaviour.

Given I have TextInputColumn::make('amountOrdered')->label('ordered'),
Now I want to write some tests around this. So I tried:

livewire(OrderItemResource\Pages\ListOrderItems::class)
        ->set('amountOrdered' , 1);

However this gives me an error:

   FAILED  Tests\Feature\OrderItemTest > it can propperly increase and decrease the product stock                                                        PublicPropertyNotFoundException
  Unable to set component data. Public property [$amountOrdered] not found on component: [app.filament.resources.order-item-resource.pages.list-order-items]


Any suggestions?
Solution
you can use updateTableColumnState

$column = 'name';
$record = 1;
$newValue = 'new value';

livewire(ListOrderItems::class)
    ->call('updateTableColumnState', $column, $record, $newValue);

assertDatabaseHas(OrderItem::class, [
    'id' => $record,
    'name' => $newValue
]);
Was this page helpful?