[verified] fix: separate account capacity panel

This commit is contained in:
2026-05-09 17:21:22 +09:00
parent bfa8bb69f5
commit 1a6deae48d
5 changed files with 101 additions and 50 deletions

View File

@@ -5,13 +5,14 @@ import { join } from 'node:path';
const appSource = readFileSync(join(import.meta.dir, '../src/App.tsx'), 'utf8');
describe('dashboard account capacity bars', () => {
test('renders compact per-account capacity bars without verbose labels', () => {
test('renders compact per-account capacity bars in a dedicated panel', () => {
expect(appSource).toContain('<CardTitle>Per-account capacity</CardTitle>');
expect(appSource).toContain('const accountWindows = extractUsageWindows(account.usage);');
expect(appSource).toContain('const accountCapacityBars = [');
expect(appSource).toContain("className=\"space-y-2\"");
expect(appSource).toContain("className=\"space-y-3\"");
expect(appSource).toContain("className=\"space-y-2 rounded-2xl border border-white/10 bg-white/4 p-4\"");
expect(appSource).toContain('indicatorClassName={getUsageProgressTone(progressValue)}');
expect(appSource).toContain("className=\"min-w-10 text-right text-xs font-medium text-slate-400\"");
expect(appSource).not.toContain('Account capacity');
expect(appSource).not.toContain('Primary window used');
expect(appSource).not.toContain('Secondary window used');
});

View File

@@ -14,6 +14,7 @@ describe('dashboard unified capacity windows', () => {
expect(appSource).toContain('getUsageProgressTone(progressValue)');
expect(appSource).toContain('const fastestResetAt = getFastestResetAt(');
expect(appSource).toContain('Replenishes at');
expect(appSource).not.toContain('Replenish after');
expect(appSource).not.toContain('Window data from');
expect(appSource).not.toContain('Resets ');
expect(appSource).not.toContain('<CardTitle>Usage metrics</CardTitle>');

View File

@@ -11,6 +11,7 @@ describe('dashboard card copy', () => {
expect(appSource).toContain('Primary window');
expect(appSource).toContain('Secondary window');
expect(appSource).toContain('Replenishes at');
expect(appSource).not.toContain('Replenish after');
expect(appSource).not.toContain('Window data from');
expect(appSource).not.toContain('<CardTitle>Usage metrics</CardTitle>');
expect(appSource).toContain(">Merged by default. Inspect each account below.<");

View File

@@ -5,10 +5,12 @@ import { join } from 'node:path';
const appSource = readFileSync(join(import.meta.dir, '../src/App.tsx'), 'utf8');
describe('mobile overflow guards', () => {
test('unified capacity window cards stay in a responsive full-height two-column grid', () => {
expect(appSource).toContain('className="grid flex-1 gap-4 md:auto-rows-fr md:grid-cols-2"');
expect(appSource).toContain('className="flex h-full flex-col justify-between rounded-2xl border border-white/10 bg-white/4 p-4"');
expect(appSource).toContain('className="text-sm text-slate-400">{item.title}</div>');
test('unified capacity window cards stay inside the card without h-full overflow', () => {
expect(appSource).toContain('className="flex h-full flex-col overflow-hidden"');
expect(appSource).toContain('className="flex flex-1 flex-col gap-4"');
expect(appSource).toContain('className="grid flex-1 items-stretch gap-4 md:grid-cols-2"');
expect(appSource).toContain('className="flex min-h-0 flex-1 flex-col justify-between rounded-2xl border border-white/10 bg-white/4 p-4"');
expect(appSource).toContain('Replenishes at {formatDate(item.window.resetAt)}');
});
test('connected account tabs no longer render a side-by-side payload column', () => {