From 5b576c3d4574950fd96178a9f7e5b40cdff38363 Mon Sep 17 00:00:00 2001 From: Mayank Date: Sun, 7 Jul 2024 16:02:43 +0530 Subject: [PATCH] Update unnit tests --- src/App.test.tsx | 17 +++++++++++++++++ vitest.setup.ts | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/App.test.tsx b/src/App.test.tsx index 5f269c1..0e9661e 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -170,4 +170,21 @@ describe("Test Board", () => { expect(el).toBeDefined(); act(() => fireEvent.click(el)); }); + + test("Set Column color renders", () => { + const columnEl = screen.getByTestId("column-0"); + const colorBtn = columnEl + .getElementsByClassName(columnListStyles.headerContent)[0] + .getElementsByTagName("button")[0]; + act(() => fireEvent.click(colorBtn)); + act(() => fireEvent.click(screen.getByText("Ok"))); + }); + + test("Set Task color renders", () => { + const columnEl = screen.getByTestId("column-0"); + const taskHEaderEl = columnEl.getElementsByClassName(taskStyles.task)[0].getElementsByTagName("header")[0]; + const colorBtn = taskHEaderEl.getElementsByTagName("button")[0]; + act(() => fireEvent.click(colorBtn)); + act(() => fireEvent.click(screen.getByText("Ok"))); + }); }); diff --git a/vitest.setup.ts b/vitest.setup.ts index a540809..dc5f9b8 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -1,4 +1,5 @@ import "@testing-library/jest-dom"; +import { useState } from "react"; import { vi } from "vitest"; export const scrollIntoViewMock = vi.fn(); @@ -19,3 +20,5 @@ Object.defineProperty(window, "matchMedia", { }); vi.mock("react-webgl-trails", () => ({ MouseTrail: () => null })); + +vi.mock("react-color-palette", () => ({ ColorPicker: () => null, useColor: useState }));