test(actions): cover native modals for actions with fields
This commit is contained in:
3 files changed
+44
No files matched your search
@@ -131,6 +131,30 @@ class RowActionsTest extends TestCase
|
||||
$this->assertFalse($actions[0]['action']['withoutConfirmation']);
|
||||
}
|
||||
|
||||
public function test_field_actions_preserve_novas_native_modal_strategy_by_default(): void
|
||||
{
|
||||
$field = RowActions::make()
|
||||
->add(ConfigurableAction::make());
|
||||
|
||||
$action = $this->serialize($field, $this->model())['actions'][0]['action'];
|
||||
|
||||
$this->assertSame('confirm-action-modal', $action['component']);
|
||||
$this->assertFalse($action['withoutConfirmation']);
|
||||
$this->assertSame('reason', $action['fields'][0]['attribute']);
|
||||
$this->assertSame('text-field', $action['fields'][0]['component']);
|
||||
}
|
||||
|
||||
public function test_confirm_false_explicitly_bypasses_the_native_action_modal(): void
|
||||
{
|
||||
$field = RowActions::make()
|
||||
->add(ConfigurableAction::make(), confirm: false);
|
||||
|
||||
$action = $this->serialize($field, $this->model())['actions'][0]['action'];
|
||||
|
||||
$this->assertNotEmpty($action['fields']);
|
||||
$this->assertTrue($action['withoutConfirmation']);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
private function serialize(RowActions $field, RowActionModel $model): array
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user