From b34236b32f0f26ef6e3afcbf92e8bad6f705c729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 17:22:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(js):=20=E8=A1=A5=E9=BD=90toastWarning/toas?= =?UTF-8?q?tError=E5=B0=81=E8=A3=85(=E7=BB=9F=E4=B8=80=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E5=8F=A3=E5=BE=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/admin.js | 9 +++++++ ...tWarningAndErrorHelpersShouldExistTest.php | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/Feature/AdminJsToastWarningAndErrorHelpersShouldExistTest.php diff --git a/public/js/admin.js b/public/js/admin.js index e748ade..a135e4a 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -585,6 +585,15 @@ return toast('success', text, 2500); } + function toastWarning(text) { + return toast('warning', text, 4500); + } + + function toastError(text) { + // error 需要更久,避免运营错过 + return toast('error', text, 9000); + } + // 通用:按钮短暂反馈(已复制/复制失败)并自动恢复 // 说明:用于复制 run_id / 复制治理链接,避免两套口径漂移。 function tempButtonFeedback(btn, ok, origAttr) { diff --git a/tests/Feature/AdminJsToastWarningAndErrorHelpersShouldExistTest.php b/tests/Feature/AdminJsToastWarningAndErrorHelpersShouldExistTest.php new file mode 100644 index 0000000..0eb4fbd --- /dev/null +++ b/tests/Feature/AdminJsToastWarningAndErrorHelpersShouldExistTest.php @@ -0,0 +1,24 @@ +assertIsString($js); + + $this->assertStringContainsString('function toastWarning', $js); + $this->assertStringContainsString("toast('warning'", $js); + + $this->assertStringContainsString('function toastError', $js); + $this->assertStringContainsString("toast('error'", $js); + } +}