Keep the review card’s fallback color on the draft so a reload does not pick a new one.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
56adcd59fd
commit
6d536880fe
8 files changed
+165
-8
No files matched your search
@@ -148,6 +148,20 @@ describe("createFlowStateSchema", () => {
|
||||
expect(r.success).toBe(true);
|
||||
});
|
||||
|
||||
it("accepts previewSurfaceColor hsl fills", () => {
|
||||
const r = createFlowStateSchema.safeParse({
|
||||
previewSurfaceColor: "hsl(12, 50%, 80%)",
|
||||
});
|
||||
expect(r.success).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects previewSurfaceColor that is not an hsl fill", () => {
|
||||
const r = createFlowStateSchema.safeParse({
|
||||
previewSurfaceColor: "red",
|
||||
});
|
||||
expect(r.success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts templateReviewBackSlug", () => {
|
||||
const r = createFlowStateSchema.safeParse({
|
||||
templateReviewBackSlug: "mutual-aid-mondays",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
isPreviewSurfaceColor,
|
||||
mostCommonOpaqueColor,
|
||||
randomPreviewSurfaceColor,
|
||||
readableCardFill,
|
||||
@@ -75,3 +76,15 @@ describe("randomPreviewSurfaceColor", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isPreviewSurfaceColor", () => {
|
||||
it("accepts the hsl strings this module writes", () => {
|
||||
expect(isPreviewSurfaceColor("hsl(12, 50%, 80%)")).toBe(true);
|
||||
expect(isPreviewSurfaceColor("hsl(359, 84%, 87%)")).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects other CSS colors", () => {
|
||||
expect(isPreviewSurfaceColor("rgb(12, 80, 40)")).toBe(false);
|
||||
expect(isPreviewSurfaceColor("red")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user