feat(guide) : improve extra cards and navigation
CI / Verify (push) Successful in 1m25s
CI / Build immutable images and deploy (push) Failing after 50s

This commit is contained in:
2026-09-04 22:40:27 +07:00 Unverified
parent 5f74ce1de6
commit ced9b41737
16 changed files with 3780 additions and 224 deletions
+26
View File
@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { highlightTextSegments } from "@/lib/guides/highlights";
describe("Extra text highlights", () => {
it("colors every exact occurrence while preserving surrounding text", () => {
expect(highlightTextSegments("MASSIVE damage\nMASSIVE range", [
{ text: "MASSIVE", color: "#FF0000" },
])).toEqual([
{ text: "MASSIVE", color: "#FF0000" },
{ text: " damage\n", color: null },
{ text: "MASSIVE", color: "#FF0000" },
{ text: " range", color: null },
]);
});
it("prefers the longer phrase when highlights overlap", () => {
expect(highlightTextSegments("very high damage", [
{ text: "high", color: "#00FF00" },
{ text: "high damage", color: "#FF0000" },
])).toEqual([
{ text: "very ", color: null },
{ text: "high damage", color: "#FF0000" },
]);
});
});