feat(guide) : improve extra cards and navigation
This commit is contained in:
@@ -139,23 +139,24 @@ describe("structured guide validation", () => {
|
||||
expect(teamSectionSchema.safeParse(input).success).toBe(true);
|
||||
});
|
||||
|
||||
it("accepts Extra card colors only as a valid pair", () => {
|
||||
it("validates Extra card backgrounds and word highlights", () => {
|
||||
const row = {
|
||||
mediaId: null,
|
||||
heading: "Extra card",
|
||||
body: "First line\nSecond line",
|
||||
percent: null,
|
||||
};
|
||||
const input = (colors: { backgroundColor: string | null; textColor: string | null }) => ({
|
||||
const input = (style: { backgroundColor: string | null; highlights: Array<{ text: string; color: string }> }) => ({
|
||||
expectedVersion: 1,
|
||||
sections: [{ title: "Extra", rows: [{ ...row, ...colors }] }],
|
||||
sections: [{ title: "Extra", rows: [{ ...row, ...style }] }],
|
||||
});
|
||||
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, textColor: null })).success).toBe(true);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: "#24232C", textColor: "#F5F2EA" })).success).toBe(true);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [] })).success).toBe(true);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: "#24232C", highlights: [{ text: "MASSIVE", color: "#FF0000" }] })).success).toBe(true);
|
||||
expect(extraSectionSchema.safeParse({ expectedVersion: 1, sections: [{ title: "Extra", rows: [row] }] }).success).toBe(true);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: "#24232C", textColor: null })).success).toBe(false);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: "red", textColor: "#F5F2EA" })).success).toBe(false);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: "red", highlights: [] })).success).toBe(false);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [{ text: "MASSIVE", color: "red" }] })).success).toBe(false);
|
||||
expect(extraSectionSchema.safeParse(input({ backgroundColor: null, highlights: [{ text: "MASSIVE", color: "#FF0000" }, { text: "MASSIVE", color: "#00FF00" }] })).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user