diff --git a/WonderQ-Admin-UI-Vue/src/pages/MediaPage.test.ts b/WonderQ-Admin-UI-Vue/src/pages/MediaPage.test.ts new file mode 100644 index 0000000..b77b21d --- /dev/null +++ b/WonderQ-Admin-UI-Vue/src/pages/MediaPage.test.ts @@ -0,0 +1,14 @@ +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const styles = readFileSync(new URL("../styles.css", import.meta.url), "utf8"); + +describe("媒体素材卡片文字", () => { + it("长标题和长 URL 应换行展示而不是被裁切", () => { + const cardTextRule = styles.match(/\.media-card-content strong,[\s\S]*?\.media-card-content small \{([\s\S]*?)\n\}/)?.[1] ?? ""; + + expect(cardTextRule).toContain("overflow-wrap: anywhere;"); + expect(cardTextRule).toContain("word-break: break-word;"); + expect(cardTextRule).toContain("white-space: normal;"); + }); +}); diff --git a/WonderQ-Admin-UI-Vue/src/styles.css b/WonderQ-Admin-UI-Vue/src/styles.css index f66b987..2c387ae 100644 --- a/WonderQ-Admin-UI-Vue/src/styles.css +++ b/WonderQ-Admin-UI-Vue/src/styles.css @@ -425,13 +425,23 @@ input { gap: 5px; padding: 10px; } +.media-card-content strong, +.media-card-content span, +.media-card-content small { + display: block; + overflow-wrap: anywhere; + word-break: break-word; + white-space: normal; +} +.media-card-content strong { + color: var(--ink); + line-height: 1.45; +} .media-card-content span, .media-card-content small { - overflow: hidden; color: var(--muted); font-size: 11px; - text-overflow: ellipsis; - white-space: nowrap; + line-height: 1.45; } .media-card-content small { color: #94a3b8;