Skip to content

Commit 147e922

Browse files
author
Fergus Bisset
committed
Updates to the ProductCards
1 parent b148367 commit 147e922

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/components/ProductCard/ProductCard.client.test.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, it, expect, vi } from "vitest";
22
import { render, screen } from "@testing-library/react";
33
import userEvent from "@testing-library/user-event";
44
import { ProductCard, ProductCardLayoutEnum } from ".";
5+
import { VectorGraphicKindEnum, ProductCardButtonVariantEnum } from "./ProductCard.types";
56

67
describe("ProductCard - Client Tests", () => {
78
describe("Rendering", () => {
@@ -99,8 +100,8 @@ describe("ProductCard - Client Tests", () => {
99100
image={{
100101
type: "graphic",
101102
shapes: [
102-
{ kind: "circle", x: 50, y: 50, size: 80, gradient: "blue" },
103-
{ kind: "rect", x: 30, y: 30, width: 60, height: 40, gradient: "aqua-green" },
103+
{ kind: VectorGraphicKindEnum.Circle, x: 50, y: 50, size: 80, gradient: "blue" },
104+
{ kind: VectorGraphicKindEnum.Rect, x: 30, y: 30, width: 60, height: 40, gradient: "aqua-green" },
104105
],
105106
}}
106107
/>
@@ -403,7 +404,7 @@ describe("ProductCard - Client Tests", () => {
403404
<ProductCard
404405
title="Test"
405406
description="Test"
406-
buttons={[{ label: "Primary", variant: "primary", onClick: vi.fn() }]}
407+
buttons={[{ label: "Primary", variant: ProductCardButtonVariantEnum.Primary, onClick: vi.fn() }]}
407408
/>
408409
);
409410

@@ -416,7 +417,7 @@ describe("ProductCard - Client Tests", () => {
416417
<ProductCard
417418
title="Test"
418419
description="Test"
419-
buttons={[{ label: "Secondary", variant: "secondary", onClick: vi.fn() }]}
420+
buttons={[{ label: "Secondary", variant: ProductCardButtonVariantEnum.Secondary, onClick: vi.fn() }]}
420421
/>
421422
);
422423

@@ -429,7 +430,7 @@ describe("ProductCard - Client Tests", () => {
429430
<ProductCard
430431
title="Test"
431432
description="Test"
432-
buttons={[{ label: "Tertiary", variant: "tertiary", onClick: vi.fn() }]}
433+
buttons={[{ label: "Tertiary", variant: ProductCardButtonVariantEnum.Tertiary, onClick: vi.fn() }]}
433434
/>
434435
);
435436

src/components/ProductCard/ProductCard.ssr.test.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, vi } from "vitest";
22
import { renderToString } from "react-dom/server";
3-
import { ProductCardLayoutEnum } from ".";
3+
import { ProductCardLayoutEnum, ProductCardButtonVariantEnum, VectorGraphicKindEnum, VectorGraphicShadowEnum } from ".";
44
import { ProductCard } from "./ProductCard";
55

66
describe("ProductCard - SSR Tests", () => {
@@ -35,8 +35,8 @@ describe("ProductCard - SSR Tests", () => {
3535
title="Test"
3636
description="Test"
3737
buttons={[
38-
{ label: "Learn More", href: "/learn", variant: "primary" },
39-
{ label: "Contact", href: "/contact", variant: "secondary" },
38+
{ label: "Learn More", href: "/learn", variant: ProductCardButtonVariantEnum.Primary },
39+
{ label: "Contact", href: "/contact", variant: ProductCardButtonVariantEnum.Secondary },
4040
]}
4141
/>
4242
);
@@ -104,9 +104,9 @@ describe("ProductCard - SSR Tests", () => {
104104
image={{
105105
type: "graphic",
106106
shapes: [
107-
{ kind: "circle", x: 50, y: 50, size: 80, gradient: "blue" },
108-
{ kind: "rect", x: 30, y: 30, width: 60, height: 40, gradient: "aqua-green" },
109-
{ kind: "hex", x: 70, y: 70, size: 60, gradient: "purple" },
107+
{ kind: VectorGraphicKindEnum.Circle, x: 50, y: 50, size: 80, gradient: "blue" },
108+
{ kind: VectorGraphicKindEnum.Rect, x: 30, y: 30, width: 60, height: 40, gradient: "aqua-green" },
109+
{ kind: VectorGraphicKindEnum.Hex, x: 70, y: 70, size: 60, gradient: "purple" },
110110
],
111111
}}
112112
/>
@@ -223,9 +223,9 @@ describe("ProductCard - SSR Tests", () => {
223223
title="Test"
224224
description="Test"
225225
buttons={[
226-
{ label: "Primary", variant: "primary", href: "#" },
227-
{ label: "Secondary", variant: "secondary", href: "#" },
228-
{ label: "Tertiary", variant: "tertiary", href: "#" },
226+
{ label: "Primary", variant: ProductCardButtonVariantEnum.Primary, href: "#" },
227+
{ label: "Secondary", variant: ProductCardButtonVariantEnum.Secondary, href: "#" },
228+
{ label: "Tertiary", variant: ProductCardButtonVariantEnum.Tertiary, href: "#" },
229229
]}
230230
/>
231231
);
@@ -297,7 +297,7 @@ describe("ProductCard - SSR Tests", () => {
297297
image={{
298298
type: "graphic",
299299
shapes: [
300-
{ kind: "circle", x: 50, y: 50, size: 80, gradient: "blue", shadow: "soft" },
300+
{ kind: VectorGraphicKindEnum.Circle, x: 50, y: 50, size: 80, gradient: "blue", shadow: VectorGraphicShadowEnum.Soft },
301301
],
302302
}}
303303
/>

0 commit comments

Comments
 (0)