feat(js): 复制失败优先toastError反馈(alert降级)
This commit is contained in:
@@ -643,6 +643,9 @@
|
||||
try { window.alert('已复制 run_id:' + runId); } catch (e) {}
|
||||
}).catch(function(){
|
||||
markCopiedRunId(false);
|
||||
if (toastError('复制失败,请手动复制 run_id:' + runId)) {
|
||||
return;
|
||||
}
|
||||
try { window.alert('复制失败,请手动复制 run_id:' + runId); } catch (e) {}
|
||||
});
|
||||
});
|
||||
@@ -684,6 +687,9 @@
|
||||
try { window.alert('已复制' + label + '链接'); } catch (e) {}
|
||||
}).catch(function(){
|
||||
markCopied(btn, false);
|
||||
if (toastError('复制失败,请手动复制' + label + '链接')) {
|
||||
return;
|
||||
}
|
||||
try { window.alert('复制失败,请手动复制' + label + '链接'); } catch (e) {}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminJsCopyFailuresShouldUseToastErrorFirstTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_copy_failures_should_use_toast_error_first(): void
|
||||
{
|
||||
$js = file_get_contents(public_path('js/admin.js'));
|
||||
$this->assertIsString($js);
|
||||
|
||||
// 复制失败时应优先 toastError(alert 作为降级)
|
||||
$this->assertStringContainsString("toastError('复制失败", $js);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user