From 8efa67bf3c441b5bf0d662417b9f3717d3693b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 06:01:37 +0800 Subject: [PATCH] ui(plans): disable-on-submit for plan create/edit form --- resources/views/admin/plans/form.blade.php | 2 +- ...AdminPlanFormShouldDisableOnSubmitTest.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlanFormShouldDisableOnSubmitTest.php diff --git a/resources/views/admin/plans/form.blade.php b/resources/views/admin/plans/form.blade.php index 7fae812..dc40445 100644 --- a/resources/views/admin/plans/form.blade.php +++ b/resources/views/admin/plans/form.blade.php @@ -13,7 +13,7 @@ -
+ @csrf @php diff --git a/tests/Feature/AdminPlanFormShouldDisableOnSubmitTest.php b/tests/Feature/AdminPlanFormShouldDisableOnSubmitTest.php new file mode 100644 index 0000000..640d171 --- /dev/null +++ b/tests/Feature/AdminPlanFormShouldDisableOnSubmitTest.php @@ -0,0 +1,34 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_plan_create_form_should_disable_on_submit(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/plans/create'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('data-action="disable-on-submit"', $html); + $this->assertStringContainsString('保存套餐', $html); + } +}