feat: update figma category card icons
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { categoryCardLines } from "./categoryDisplay";
|
||||
import { categoryCardLines, cleanCategoryDisplayName } from "./categoryDisplay";
|
||||
|
||||
describe("cleanCategoryDisplayName", () => {
|
||||
it("removes parenthetical suffixes used as backend qualifiers", () => {
|
||||
expect(cleanCategoryDisplayName("官方公告(繁中)")).toBe("官方公告");
|
||||
expect(cleanCategoryDisplayName("Tutorials (EN)")).toBe("Tutorials");
|
||||
expect(cleanCategoryDisplayName("补贴政策\r")).toBe("补贴政策");
|
||||
});
|
||||
});
|
||||
|
||||
describe("categoryCardLines", () => {
|
||||
it("splits Chinese and ASCII parenthetical subtitles", () => {
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
export function cleanCategoryDisplayName(name: string): string {
|
||||
return name
|
||||
.replace(/\s*[((][^()()]*[))]\s*/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
/** Split display name into title + parenthetical subtitle (matches design cards). */
|
||||
export function categoryCardLines(
|
||||
name: string,
|
||||
|
||||
Reference in New Issue
Block a user