feat(js): 补齐toastWarning/toastError封装(统一反馈口径)
This commit is contained in:
@@ -585,6 +585,15 @@
|
|||||||
return toast('success', text, 2500);
|
return toast('success', text, 2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toastWarning(text) {
|
||||||
|
return toast('warning', text, 4500);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toastError(text) {
|
||||||
|
// error 需要更久,避免运营错过
|
||||||
|
return toast('error', text, 9000);
|
||||||
|
}
|
||||||
|
|
||||||
// 通用:按钮短暂反馈(已复制/复制失败)并自动恢复
|
// 通用:按钮短暂反馈(已复制/复制失败)并自动恢复
|
||||||
// 说明:用于复制 run_id / 复制治理链接,避免两套口径漂移。
|
// 说明:用于复制 run_id / 复制治理链接,避免两套口径漂移。
|
||||||
function tempButtonFeedback(btn, ok, origAttr) {
|
function tempButtonFeedback(btn, ok, origAttr) {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminJsToastWarningAndErrorHelpersShouldExistTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function test_admin_js_should_include_toast_warning_and_error_helpers(): void
|
||||||
|
{
|
||||||
|
$js = file_get_contents(public_path('js/admin.js'));
|
||||||
|
|
||||||
|
$this->assertIsString($js);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('function toastWarning', $js);
|
||||||
|
$this->assertStringContainsString("toast('warning'", $js);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('function toastError', $js);
|
||||||
|
$this->assertStringContainsString("toast('error'", $js);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user