Testing createOptionForm within an action

Whats the recommened way to test a createOptionForm within an action? I had this working in v3 but in v4 I get this error Unable to set component data. Public property [$mountedFormComponentActionsData] not found on component
livewire(Devices::class, ['folder' => $this->folder, 'account' => $this->client])
->mountAction('createDevice')
->call('mountFormComponentAction', 'mountedActionsData.0.device_manufacturer_id', 'createOption')
->set('mountedFormComponentActionsData.0.name', $newManufacturerName)
->callMountedFormComponentAction();
livewire(Devices::class, ['folder' => $this->folder, 'account' => $this->client])
->mountAction('createDevice')
->call('mountFormComponentAction', 'mountedActionsData.0.device_manufacturer_id', 'createOption')
->set('mountedFormComponentActionsData.0.name', $newManufacturerName)
->callMountedFormComponentAction();
Solution:
This can be solved using the new TestAction class introduced in V4. ```livewire(Devices::class, ['folder' => $this->folder, 'account' => $this->client]) ->mountAction('createDevice') ->mountAction(TestAction::make('createOption')->schemaComponent('device_manufacturer_id'))...
Jump to solution
2 Replies
Mark Chaney
Mark Chaney3w ago
any luck?
Solution
andis
andis3w ago
This can be solved using the new TestAction class introduced in V4.
livewire(Devices::class, ['folder' => $this->folder, 'account' => $this->client])
->mountAction('createDevice')
->mountAction(TestAction::make('createOption')->schemaComponent('device_manufacturer_id'))
->fillForm([
'name' => $newManufacturerName,
])
->callMountedAction();
livewire(Devices::class, ['folder' => $this->folder, 'account' => $this->client])
->mountAction('createDevice')
->mountAction(TestAction::make('createOption')->schemaComponent('device_manufacturer_id'))
->fillForm([
'name' => $newManufacturerName,
])
->callMountedAction();

Did you find this page helpful?