diff --git a/package-lock.json b/package-lock.json
index 319240ac..29677a17 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -52,6 +52,7 @@
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.7.0",
+ "jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jsdom-testing-mocks": "^1.11.0",
"pre-commit": "^1.2.2",
@@ -10906,6 +10907,12 @@
"node": ">=4"
}
},
+ "node_modules/cssfontparser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz",
+ "integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==",
+ "dev": true
+ },
"node_modules/cssom": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz",
@@ -15405,6 +15412,16 @@
}
}
},
+ "node_modules/jest-canvas-mock": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz",
+ "integrity": "sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==",
+ "dev": true,
+ "dependencies": {
+ "cssfontparser": "^1.2.1",
+ "moo-color": "^1.0.2"
+ }
+ },
"node_modules/jest-changed-files": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz",
@@ -19781,6 +19798,15 @@
"integrity": "sha512-iniQP4rj1FhBdBYS/+eQv7j1tadJ9lJtdzgOpvsOHng/GbcDh2Fhdeq+ZRldrPYdXvCyfFUmFeEwEGXZB5I/AQ==",
"peer": true
},
+ "node_modules/moo-color": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz",
+ "integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "^1.1.4"
+ }
+ },
"node_modules/mri": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
diff --git a/package.json b/package.json
index 82121098..5096d3f6 100644
--- a/package.json
+++ b/package.json
@@ -79,6 +79,7 @@
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.7.0",
+ "jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jsdom-testing-mocks": "^1.11.0",
"pre-commit": "^1.2.2",
diff --git a/src/components/accordion/overrides.tsx b/src/components/accordion/overrides.tsx
index e264a447..a06c34a3 100644
--- a/src/components/accordion/overrides.tsx
+++ b/src/components/accordion/overrides.tsx
@@ -1,10 +1,11 @@
import { AccordionOverrides } from "baseui/accordion";
+import { expandProperty } from "inline-style-expand-shorthand";
export const getAccordionOverrides = (): AccordionOverrides => {
return {
PanelContainer: {
style: () => ({
- borderBottom: "none",
+ ...expandProperty("borderBottom", "none"),
marginTop: "4px",
}),
},
diff --git a/src/components/chart/Chart.test.tsx b/src/components/chart/Chart.test.tsx
new file mode 100644
index 00000000..d5ce658a
--- /dev/null
+++ b/src/components/chart/Chart.test.tsx
@@ -0,0 +1,48 @@
+import { render } from "@testing-library/react";
+import Chart from "./ChartWrapper";
+import { LineSeries } from "./series";
+import { MockViewport, mockViewport } from "jsdom-testing-mocks";
+import { setupJestCanvasMock } from "jest-canvas-mock";
+
+let viewport: MockViewport;
+
+beforeEach(() => {
+ viewport = mockViewport({ width: "1320px", height: "568px" });
+ setupJestCanvasMock();
+});
+
+afterEach(() => {
+ viewport.cleanup();
+});
+
+const lineData = [
+ { time: "2018-12-22", value: 23 },
+ { time: "2018-12-23", value: 54 },
+ { time: "2018-12-24", value: 36 },
+ { time: "2018-12-25", value: 48 },
+ { time: "2018-12-26", value: 24 },
+ { time: "2018-12-27", value: 73 },
+ { time: "2018-12-28", value: 287 },
+ { time: "2018-12-29", value: 96 },
+ { time: "2018-12-30", value: 37 },
+ { time: "2018-12-31", value: 54 },
+ { time: "2019-01-01", value: 62 },
+ { time: "2019-01-02", value: 71 },
+ { time: "2019-01-03", value: 88 },
+ { time: "2019-01-04", value: 99 },
+ { time: "2019-01-05", value: 13 },
+ { time: "2019-01-06", value: 28 },
+ { time: "2019-01-07", value: 92 },
+];
+
+describe("Chart", () => {
+ it("renders without crashing", () => {
+ render(
+
+
+
+ );
+ });
+
+ // Add more tests as needed
+});
diff --git a/src/components/icons/Icons.test.tsx b/src/components/icons/Icons.test.tsx
new file mode 100644
index 00000000..06909aa3
--- /dev/null
+++ b/src/components/icons/Icons.test.tsx
@@ -0,0 +1,17 @@
+import { isValidElement } from "react";
+import * as Icons from ".";
+import { render } from "../../test-utils/render";
+
+describe("Icons", () => {
+ it("all icons render", () => {
+ const keys = Object.keys(Icons);
+ keys.forEach((key) => {
+ const Icon = Icons[key as keyof typeof Icons];
+
+ if (isValidElement()) {
+ const { container } = render();
+ expect(container.firstChild).toBeInTheDocument();
+ }
+ });
+ });
+});
diff --git a/src/components/menu/ui/MenuItem.tsx b/src/components/menu/ui/MenuItem.tsx
index 0550e490..a3397cab 100644
--- a/src/components/menu/ui/MenuItem.tsx
+++ b/src/components/menu/ui/MenuItem.tsx
@@ -1,4 +1,4 @@
-import React, { forwardRef } from "react";
+import { cloneElement, forwardRef } from "react";
import { MenuItemProps, MenuItemTypographyProps } from "../types";
import { ParagraphSmall, ParagraphMedium, ParagraphLarge } from "baseui/typography";
import { useStyletron, styled } from "baseui";
@@ -38,7 +38,7 @@ const MenuItem = forwardRef(
{item?.selected != null && }
{item?.startEnhancer &&
- React.cloneElement(item.startEnhancer, {
+ cloneElement(item.startEnhancer, {
size: 16,
className: css(isAreaSelected ? svgActiveStyles : {}),
})}
@@ -48,7 +48,7 @@ const MenuItem = forwardRef(
{item?.suffixText && {item.suffixText}}
{item?.endEnhancer &&
- React.cloneElement(item.endEnhancer, {
+ cloneElement(item.endEnhancer, {
size: 16,
className: css(isAreaSelected ? svgActiveStyles : {}),
})}