chore(admin-platform-order): disable clear-error buttons unless in failed scopes

This commit is contained in:
萝卜
2026-03-16 13:12:21 +08:00
parent e23ae4de61
commit 50e5b35a14
2 changed files with 67 additions and 2 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_clear_error_buttons_should_disable_when_filters_not_in_failed_scopes(): void
{
$this->loginAsPlatformAdmin();
// 默认列表(未进入失败集合)
$res = $this->get('/admin/platform-orders');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('清除同步失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-sync-errors-blocked-hint"', $html);
$this->assertStringContainsString('同步失败', $html);
$this->assertStringContainsString('清除批量标记支付失败标记(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html);
$this->assertStringContainsString('BMPA失败', $html);
// 按钮 disabled宽松断言
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
}