fix : use correct icon for % stats
This commit is contained in:
@@ -104,12 +104,15 @@ describe("structured guide validation", () => {
|
||||
expect(artifactSectionSchema.safeParse({ ...base, recommendedGroups: [{ ...first, note: "x".repeat(2_001) }] }).success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts flat artifact substats with the same icons as their percentage variants", () => {
|
||||
it("uses distinct icons for flat and percentage HP, ATK, and DEF stats", () => {
|
||||
const result = artifactSectionSchema.safeParse({ expectedVersion: 1, groups: artifactGroups, sands: [], goblet: [], circlet: [], substats: ["ATK", "HP", "DEF"], targetGroups: [], talents: [], note: null });
|
||||
expect(result.success).toBe(true);
|
||||
expect(targetStatIconName("ATK")).toBe(recommendedStatIconName("ATK%"));
|
||||
expect(targetStatIconName("HP")).toBe(recommendedStatIconName("HP%"));
|
||||
expect(targetStatIconName("DEF")).toBe(recommendedStatIconName("DEF%"));
|
||||
expect(recommendedStatIconName("ATK%")).toBe("atk-percent");
|
||||
expect(recommendedStatIconName("HP%")).toBe("hp-percent");
|
||||
expect(recommendedStatIconName("DEF%")).toBe("def-percent");
|
||||
expect(targetStatIconName("ATK")).toBe("atk");
|
||||
expect(targetStatIconName("HP")).toBe("hp");
|
||||
expect(targetStatIconName("DEF")).toBe("def");
|
||||
});
|
||||
|
||||
it("maps elemental damage recommendations to Lunaris element icons", () => {
|
||||
|
||||
@@ -48,6 +48,7 @@ export function recommendedStatIconName(value: string): string | null {
|
||||
if (value.endsWith(" DMG%")) return "elemental-bonus";
|
||||
|
||||
const base = value.replace(/%$/, "").toLowerCase();
|
||||
if (value.endsWith("%") && ["hp", "atk", "def"].includes(base)) return `${base}-percent`;
|
||||
return ["hp", "atk", "def", "em", "er"].includes(base) ? base : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user