fix(ui): 修复登录和并发请求并统一页面展示
调整登录流程和请求处理,统一各中心的表格交互、主题样式和页面展示。
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { colord } from 'colord';
|
||||
import {
|
||||
resolveBrandPalette,
|
||||
resolveGradientLabel,
|
||||
} from '../../src/helpers/brandPalette.js';
|
||||
import { PRESETS } from '../../src/styles/presets.js';
|
||||
|
||||
test('brand interactions retain readable contrast in all solid states', () => {
|
||||
for (const dark of [false, true]) {
|
||||
const mode = dark ? 'dark' : 'light';
|
||||
const surface = dark ? '#1b212b' : '#ffffff';
|
||||
const inputs = [
|
||||
...Object.values(PRESETS).map((preset) => preset[mode]['brand-primary']),
|
||||
'#000000',
|
||||
'#ffffff',
|
||||
'#eaff00',
|
||||
'#00ffff',
|
||||
'#010331',
|
||||
'#ee00ff',
|
||||
'#ff552280',
|
||||
'not-a-color',
|
||||
];
|
||||
for (const input of inputs) {
|
||||
const palette = resolveBrandPalette(input, dark, surface);
|
||||
for (const state of ['normal', 'hover', 'active']) {
|
||||
const fill = colord(palette[state]);
|
||||
assert.equal(fill.alpha(), 1);
|
||||
assert.ok(
|
||||
fill.contrast(palette.onSolid) >= 4.5,
|
||||
[mode, input, state].join(' '),
|
||||
);
|
||||
}
|
||||
assert.ok(
|
||||
colord(palette.selectionText).contrast(palette.selectionBg) >= 4.5,
|
||||
);
|
||||
if (!palette.isPrototype) {
|
||||
assert.ok(colord(palette.accent).contrast(palette.tintHover) >= 4.5);
|
||||
assert.ok(colord(palette.tint).contrast(surface) < 1.6);
|
||||
if (dark)
|
||||
assert.ok(colord(palette.hover).contrast(palette.onSolid) < 7.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('prototype amber retains its selected foreground and surface', () => {
|
||||
const light = resolveBrandPalette('#B96508', false, '#ffffff');
|
||||
const dark = resolveBrandPalette('#D1963A', true, '#1b212b');
|
||||
assert.deepEqual(
|
||||
[light.selectionBg, light.selectionText],
|
||||
['#fff3df', '#a45a07'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
[dark.selectionBg, dark.selectionText],
|
||||
['#382b1b', '#f2ad41'],
|
||||
);
|
||||
});
|
||||
|
||||
test('preview gradient labels use readable ink or a neutral backing', () => {
|
||||
assert.deepEqual(resolveGradientLabel(['#d1963a', '#f2ad41'], '#101014'), {
|
||||
color: '#11151c',
|
||||
});
|
||||
assert.deepEqual(resolveGradientLabel(['#0e192a', '#17436b'], '#f6f8fb'), {
|
||||
color: '#ffffff',
|
||||
});
|
||||
assert.deepEqual(
|
||||
resolveGradientLabel(['#ffffff80', '#ffffff00'], '#010101'),
|
||||
{
|
||||
color: '#ffffff',
|
||||
background: '#010101',
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user