A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix(icon-picker): allow selecting the empty/no-icon option (#3298)
Garuda CCS13e584d52200
diff --git a/apps/web/src/components/input/icon-picker.test.tsx b/apps/web/src/components/input/icon-picker.test.tsxindex 42d90c749..011471df2 100644--- a/apps/web/src/components/input/icon-picker.test.tsx+++ b/apps/web/src/components/input/icon-picker.test.tsx@@ -1,6 +1,6 @@// @vitest-environment happy-dom-import { render } from "@testing-library/react";+import { fireEvent, render, screen } from "@testing-library/react";import { beforeAll, describe, expect, it, vi } from "vitest";import { i18n } from "@lingui/core";import { I18nProvider } from "@lingui/react";@@ -68,4 +68,17 @@ describe("IconPicker", () => {const { container } = renderPicker();expect(container.querySelectorAll("button").length).toBeGreaterThanOrEqual(1);});++ it("calls onChange with an empty string when the no-icon cell is clicked", () => {+ const onChange = vi.fn();+ render(+ <I18nProvider i18n={i18n}>+ <IconPicker value="globe" onChange={onChange} popoverProps={{ defaultOpen: true }} />+ </I18nProvider>,+ );++ const firstCell = screen.getByTestId("grid").querySelector("button");+ if (firstCell) fireEvent.click(firstCell);+ expect(onChange).toHaveBeenCalledWith("");+ });});diff --git a/apps/web/src/components/input/icon-picker.tsx b/apps/web/src/components/input/icon-picker.tsxindex d0d1b7db6..2c13689c5 100644--- a/apps/web/src/components/input/icon-picker.tsx+++ b/apps/web/src/components/input/icon-picker.tsx@@ -58,7 +58,7 @@ function IconCellComponent({ columnIndex, rowIndex, style, icons, onChange }: Icstyle={style}tabIndex={-1}onClick={() => {- if (icon) onChange(icon);+ if (typeof icon === "string") onChange(icon);}}className="flex size-full items-center justify-center hover:bg-accent">