fix(*): 素材库与画布 - 修复批量删除刷新、选择布局及工具引用

This commit is contained in:
ddCat
2026-09-21 20:14:05 +08:00
parent c5b81f696c
commit dc1ad68015
27 changed files with 852 additions and 109 deletions

View File

@@ -3,6 +3,27 @@ import { readFileSync } from "node:fs";
import { resolve } from "node:path";
describe("assets page batch toolbar", () => {
const styles = readFileSync(resolve(import.meta.dir, "../src/styles/globals.css"), "utf8");
test("keeps card selection in the top left with badge clearance", () => {
const checkbox = styles.match(/\.assets-select-check\s*\{([^}]+)\}/)?.[1] ?? "";
const badges = styles.match(/\.assets-cover-badges\s*\{([^}]+)\}/)?.[1] ?? "";
expect(checkbox).toContain("left: 8px;");
expect(checkbox).toContain("top: 8px;");
expect(checkbox).not.toMatch(/(?:right|bottom):/);
expect(badges).toContain("left: 38px;");
expect(badges).toContain("right: 44px;");
});
test("keeps batch actions in document flow with space above selected cards", () => {
const toolbarRules = [...styles.matchAll(/\.assets-batch-bar\s*\{([^}]+)\}/g)].map((match) => match[1]).join("\n");
expect(toolbarRules).not.toMatch(/position:\s*(?:sticky|fixed|absolute)/);
expect(toolbarRules).not.toContain("z-index:");
expect(toolbarRules).toContain("margin: 2px 0 var(--space-4);");
const actions = styles.match(/\.assets-batch-actions\s*\{([^}]+)\}/)?.[1] ?? "";
expect(actions).toContain("flex-wrap: wrap;");
});
test("places select all before cancel selection", () => {
const source = readFileSync(resolve(import.meta.dir, "../src/pages/assets/index.tsx"), "utf8");
const selectAllIndex = source.search(/>\s*全选\s*<\/Button>/);