refactor(js): 复制失败toast文案收敛为toastCopyFailed并更新护栏
This commit is contained in:
@@ -15,6 +15,10 @@ class AdminJsCopyFailuresShouldUseToastErrorFirstTest extends TestCase
|
||||
$this->assertIsString($js);
|
||||
|
||||
// 复制失败时应优先 toastError(alert 作为降级)
|
||||
$this->assertStringContainsString("toastError('复制失败", $js);
|
||||
// 允许通过 wrapper(toastCopyFailed)间接调用 toastError。
|
||||
$this->assertTrue(
|
||||
str_contains($js, "toastError('复制失败") || str_contains($js, 'toastCopyFailed('),
|
||||
'copy failures should use toastError (directly or via toastCopyFailed wrapper)'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminJsToastCopyFailedHelperShouldExistTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_admin_js_should_include_toast_copy_failed_helper(): void
|
||||
{
|
||||
$js = file_get_contents(public_path('js/admin.js'));
|
||||
$this->assertIsString($js);
|
||||
|
||||
$this->assertStringContainsString('function toastCopyFailed', $js);
|
||||
$this->assertStringContainsString("msg = '复制失败'", $js);
|
||||
$this->assertStringContainsString("return toastError(msg)", $js);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user