Skip to content

Commit 7931e49

Browse files
committed
fix: added Test as well
1 parent 85d26a0 commit 7931e49

4 files changed

Lines changed: 3065 additions & 33 deletions

File tree

src/Odontogram.tsx

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ export const Odontogram: FC<OdontogramProps> = ({
229229
const themeColors =
230230
theme === "dark"
231231
? {
232-
"--dark-blue": "#aab6ff",
233-
"--base-blue": "#d0d5f6",
234-
"--light-blue": "#5361e6",
235-
}
232+
"--dark-blue": "#aab6ff",
233+
"--base-blue": "#d0d5f6",
234+
"--light-blue": "#5361e6",
235+
}
236236
: {
237-
"--dark-blue": "#3e5edc",
238-
"--base-blue": "#8a98be",
239-
"--light-blue": "#c6ccf8",
240-
};
237+
"--dark-blue": "#3e5edc",
238+
"--base-blue": "#8a98be",
239+
"--light-blue": "#c6ccf8",
240+
};
241241

242242
const [selected, setSelected] = useState<Set<string>>(
243243
new Set(defaultSelected),
@@ -292,31 +292,31 @@ export const Odontogram: FC<OdontogramProps> = ({
292292
label: string;
293293
position: { x: number; y: number };
294294
}> = [
295-
{
296-
name: "first",
297-
transform: "",
298-
label: "Upper Right",
299-
position: { x: 100, y: 30 },
300-
},
301-
{
302-
name: "second",
303-
transform: "scale(-1, 1) translate(-409, 0)",
304-
label: "Upper Left",
305-
position: { x: 309, y: 30 },
306-
},
307-
{
308-
name: "third",
309-
transform: "scale(1, -1) translate(0, -694)",
310-
label: "Lower Right",
311-
position: { x: 100, y: 664 },
312-
},
313-
{
314-
name: "fourth",
315-
transform: "scale(-1, -1) translate(-409, -694)",
316-
label: "Lower Left",
317-
position: { x: 309, y: 664 },
318-
},
319-
];
295+
{
296+
name: "first",
297+
transform: "",
298+
label: "Upper Right",
299+
position: { x: 100, y: 30 },
300+
},
301+
{
302+
name: "second",
303+
transform: "scale(-1, 1) translate(-409, 0)",
304+
label: "Upper Left",
305+
position: { x: 309, y: 30 },
306+
},
307+
{
308+
name: "third",
309+
transform: "scale(1, -1) translate(0, -694)",
310+
label: "Lower Right",
311+
position: { x: 100, y: 664 },
312+
},
313+
{
314+
name: "fourth",
315+
transform: "scale(-1, -1) translate(-409, -694)",
316+
label: "Lower Left",
317+
position: { x: 309, y: 664 },
318+
},
319+
];
320320

321321
let visibleQuadrants = quadrants;
322322
if (showHalf === "upper") {

tests/Odontogram.test.tsx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { describe, it, expect } from "vitest";
2+
import { render } from "@testing-library/react";
3+
import Odontogram from "../src/Odontogram";
4+
5+
describe("Odontogram Component Snapshots", () => {
6+
it("renders full odontogram correctly", () => {
7+
const { container } = render(
8+
<Odontogram
9+
theme="light"
10+
colors={{
11+
darkBlue: "#0000ff",
12+
baseBlue: "#8888ff",
13+
lightBlue: "#ccccff",
14+
}}
15+
showHalf="full"
16+
/>
17+
);
18+
19+
expect(container).toMatchSnapshot();
20+
});
21+
22+
it("renders upper half odontogram", () => {
23+
const { container } = render(
24+
<Odontogram
25+
theme="light"
26+
colors={{
27+
darkBlue: "#0000ff",
28+
baseBlue: "#8888ff",
29+
lightBlue: "#ccccff",
30+
}}
31+
showHalf="upper"
32+
/>
33+
);
34+
35+
expect(container).toMatchSnapshot();
36+
});
37+
38+
it("renders lower half odontogram", () => {
39+
const { container } = render(
40+
<Odontogram
41+
theme="light"
42+
colors={{
43+
darkBlue: "#0000ff",
44+
baseBlue: "#8888ff",
45+
lightBlue: "#ccccff",
46+
}}
47+
showHalf="lower"
48+
/>
49+
);
50+
51+
expect(container).toMatchSnapshot();
52+
});
53+
54+
it("renders dark theme correctly", () => {
55+
const { container } = render(
56+
<Odontogram
57+
theme="dark"
58+
colors={{
59+
darkBlue: "#222222",
60+
baseBlue: "#444444",
61+
lightBlue: "#666666",
62+
}}
63+
showHalf="full"
64+
/>
65+
);
66+
67+
expect(container).toMatchSnapshot();
68+
});
69+
});

0 commit comments

Comments
 (0)