mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 07:00:22 +08:00
fix: 深色模式主按钮白底白字,版本 1.1.85(#196)
宿主暗色主题把 --dsw-alias-brand-primary 解析为近白色 #f9fafb,设置页与演练台以它为底 + 白字的按钮全部变成白块。暗色下统一改用 #3d8f68 绿色实底与 #347a59 悬停色,并显式写 -webkit-text-fill-color;新增静态测试守护。
This commit is contained in:
1 parent
af473428ed
commit
9716ca3e87
4 files changed
+85
-1
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import test from "node:test";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const client = readFileSync(join(root, "client.js"), "utf8");
|
||||
|
||||
function rule(selector) {
|
||||
const at = client.indexOf(selector);
|
||||
if (at < 0) return "";
|
||||
const brace = client.indexOf("{", at);
|
||||
const end = client.indexOf("}", brace);
|
||||
return brace < 0 || end < 0 ? "" : client.slice(brace + 1, end);
|
||||
}
|
||||
|
||||
test("#196 暗色宿主主按钮不再使用近白色品牌底", () => {
|
||||
// 宿主暗色下 --dsw-alias-brand-primary = #f9fafb,直接拿它作底会白底白字。
|
||||
for (const selector of [
|
||||
'body[data-ds-dark-theme] .dshp-btn-primary',
|
||||
'.dshp-root[data-theme="dusk"] .dshp-btn-primary',
|
||||
'.dshp-dock[data-theme="dusk"] .dshp-btn-primary',
|
||||
'body[data-ds-dark-theme] .rt-btn-primary',
|
||||
'.dshp-dock[data-theme="dusk"] .rt-btn-primary',
|
||||
'.dshp-dock[data-theme="dusk"] .dshp-dock-body .rt-btn-primary',
|
||||
]) {
|
||||
const body = rule(selector);
|
||||
assert.match(body, /background:#3d8f68!important/, selector);
|
||||
assert.match(body, /color:#fff!important/, selector);
|
||||
}
|
||||
});
|
||||
|
||||
test("#196 暗色主按钮悬停仍有可读底色", () => {
|
||||
const body = rule('body[data-ds-dark-theme] .dshp-btn-primary:hover:not(:disabled)');
|
||||
assert.match(body, /background:#347a59!important/);
|
||||
});
|
||||
|
||||
test("#196 报告步骤序号圆点暗色下保持绿底白字", () => {
|
||||
const at = client.indexOf('body[data-ds-dark-theme] .rt-rep-step-no,.dshp-dock[data-theme="dusk"] .rt-rep-step-no');
|
||||
assert.notEqual(at, -1);
|
||||
const body = client.slice(at, client.indexOf("}", at));
|
||||
assert.match(body, /background:#3d8f68/);
|
||||
assert.match(body, /color:#fff/);
|
||||
});
|
||||
Reference in new issue
Block a user