Setting/Asserting TableActionData

does ->setTableActionData($data) wipe out default() values for the form even if its not a set in $data and can ->assertTableActionDataSet() check defaults? Was thinking something like ->assertTableActionDataSet([...$data, 'primary_case_manager' => $user->case_manager_id]). Full code being
Livewire::test(ListParticipants::class)
->mountTableAction(CreateAction::class)
->setTableActionData($data)
->assertFormFieldIsVisible('name', 'mountedTableActionForm')
->assertFormFieldIsHidden('send_welcome_email', 'mountedTableActionForm')
// assert that the case manager's agency is selected by default
->assertTableActionDataSet([...$data, 'primary_case_manager' => $user->case_manager_id])
->callMountedTableAction()
->assertHasNoTableActionErrors();
Livewire::test(ListParticipants::class)
->mountTableAction(CreateAction::class)
->setTableActionData($data)
->assertFormFieldIsVisible('name', 'mountedTableActionForm')
->assertFormFieldIsHidden('send_welcome_email', 'mountedTableActionForm')
// assert that the case manager's agency is selected by default
->assertTableActionDataSet([...$data, 'primary_case_manager' => $user->case_manager_id])
->callMountedTableAction()
->assertHasNoTableActionErrors();
. Cant seem to assert that default value of the primary_case_manager field.
Solution:
```php Livewire::test(ListParticipants::class) ->mountTableAction(CreateAction::class) ->setTableActionData($data) ->assertFormFieldIsVisible('name', 'mountedTableActionForm')...
Jump to solution
2 Replies
Solution
Mark Chaney
Mark Chaney5mo ago
Livewire::test(ListParticipants::class)
->mountTableAction(CreateAction::class)
->setTableActionData($data)
->assertFormFieldIsVisible('name', 'mountedTableActionForm')
->assertFormFieldIsHidden('send_welcome_email', 'mountedTableActionForm')
// assert that the case manager's agency is selected by default
->assertTableActionDataSet([...$data, 'primary_case_manager' => $user->case_manager_id])
->callMountedTableAction()
->assertHasNoTableActionErrors();
Livewire::test(ListParticipants::class)
->mountTableAction(CreateAction::class)
->setTableActionData($data)
->assertFormFieldIsVisible('name', 'mountedTableActionForm')
->assertFormFieldIsHidden('send_welcome_email', 'mountedTableActionForm')
// assert that the case manager's agency is selected by default
->assertTableActionDataSet([...$data, 'primary_case_manager' => $user->case_manager_id])
->callMountedTableAction()
->assertHasNoTableActionErrors();
Mark Chaney
Mark ChaneyOP5mo ago
ha, it did actually work. I think i had some other data that wasnt right due to how a factory was setup and the app being multitenant
Want results from more Discord servers?
Add your server