fix(assets): 素材库 - 修复主题按钮并新增批量全选 (#193)

This commit is contained in:
ahyang authored and GitHub committed 2026-08-09 08:58:21 +08:00
1 parent 97641f85d9
commit 1084fdef9f
4 files changed
+42 -5

No files matched your search

@@ -0,0 +1,17 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
describe("asset library header buttons", () => {
test("only forces white header buttons in light mode", () => {
const css = readFileSync(resolve(import.meta.dir, "../src/styles/globals.css"), "utf8");
const headerButtonRule = css.match(/html:not\(\.dark\) \.library-page \.app-page-header \.ant-btn,[\s\S]*?transition: all 180ms ease-out !important;\s*}/)?.[0] || "";
const headerButtonHoverRule = css.match(/html:not\(\.dark\) \.library-page \.app-page-header \.ant-btn:hover,[\s\S]*?transform: translateY\(-1px\);\s*}/)?.[0] || "";
expect(headerButtonRule).toContain("background: #ffffff !important;");
expect(headerButtonRule).toContain("color: #171717 !important;");
expect(headerButtonHoverRule).toContain("background: #ffffff !important;");
expect(headerButtonHoverRule).toContain("color: #171717 !important;");
expect(css).not.toContain("\n .library-page .app-page-header .ant-btn,\n");
});
});
@@ -0,0 +1,15 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
describe("assets page batch toolbar", () => {
test("places select all before cancel selection", () => {
const source = readFileSync(resolve(import.meta.dir, "../src/pages/assets/index.tsx"), "utf8");
const selectAllIndex = source.indexOf(">全选</Button>");
const clearSelectionIndex = source.indexOf(">取消选择</Button>");
expect(selectAllIndex).toBeGreaterThanOrEqual(0);
expect(clearSelectionIndex).toBeGreaterThanOrEqual(0);
expect(selectAllIndex).toBeLessThan(clearSelectionIndex);
});
});