mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-10-16 14:57:05 +08:00
feat(quota): update .quotaAmount styles and add tests for size consistency with quota metadata
This commit is contained in:
@@ -78,6 +78,8 @@
|
||||
|
||||
.quotaAmount {
|
||||
font-family: $font-mono;
|
||||
font-size: 11.5px;
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,18 @@ const readHost = (path: string) => Bun.file(new URL(`../${path}`, import.meta.ur
|
||||
|
||||
describe('quota class contract', () => {
|
||||
for (const [host, path] of Object.entries(HOSTS)) {
|
||||
test(`${host} gives standalone amounts the same size as quota metadata`, async () => {
|
||||
const css = await readHost(path);
|
||||
const amount = css.match(/\.quotaAmount\s*\{([^}]+)\}/)?.[1] ?? '';
|
||||
const meta = css.match(/\.quotaMeta\s*\{([^}]+)\}/)?.[1] ?? '';
|
||||
const size = amount.match(/font-size:\s*([^;]+);/)?.[1];
|
||||
expect(size).toBeDefined();
|
||||
expect(size).toBe(meta.match(/font-size:\s*([^;]+);/)?.[1]);
|
||||
expect(amount).toContain('font-family: $font-mono;');
|
||||
expect(amount).toContain('font-weight: 500;');
|
||||
expect(amount).toContain('font-variant-numeric: tabular-nums;');
|
||||
});
|
||||
|
||||
test(`${host} defines every QuotaClassMap key`, async () => {
|
||||
const css = await readHost(path);
|
||||
const missing = QUOTA_CLASS_KEYS.filter(
|
||||
|
||||
Reference in New Issue
Block a user