test(actions): cover native modals for actions with fields

This commit is contained in:
MeghdadFadaee committed 2026-07-30 14:26:02 +03:30
1 parent ade3fc100a
commit 237bcab43b
3 files changed
+44

No files matched your search

+24
View File
@@ -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
{