diff --git a/packages/ui/src/FormWidgets/CountryPicker/__test__/CountryPicker.snapshot.test.tsx b/packages/ui/src/FormWidgets/CountryPicker/__test__/CountryPicker.snapshot.test.tsx index 40057a844..dc6f18441 100644 --- a/packages/ui/src/FormWidgets/CountryPicker/__test__/CountryPicker.snapshot.test.tsx +++ b/packages/ui/src/FormWidgets/CountryPicker/__test__/CountryPicker.snapshot.test.tsx @@ -1,33 +1,78 @@ import { render } from "@testing-library/react"; -import { describe, expect, test } from "vitest"; +import { describe, expect, test, vi } from "vitest"; import { CountryPicker } from "../../CountryPicker"; -describe("CountryPicker Component", () => { - test("should render correctly with a limited list of countries", () => { +describe("CountryPicker Component Snapshots", () => { + test("renders simple list correctly", () => { const { container } = render( {}} + onChange={vi.fn()} />, ); expect(container).toMatchSnapshot(); }); - test("should render correctly with favorites and localization", () => { + test("renders with favorites and custom labels", () => { const { container } = render( {}} + labels={{ favorites: "Favoris", allCountries: "Tous les pays" }} + value="FR" + onChange={vi.fn()} + />, + ); + + expect(container).toMatchSnapshot(); + }); + + test("renders with grouped countries", () => { + const groups = { + Europe: ["FR", "DE", "GB"], + Asia: ["NP", "CN", "JP"], + }; + + const { container } = render( + , + ); + + expect(container).toMatchSnapshot(); + }); + + test("renders with flag options disabled", () => { + const { container } = render( + , + ); + + expect(container).toMatchSnapshot(); + }); + + test("renders with custom flag path function", () => { + const { container } = render( + `https://cdn.example.com/flags/${code}.png`} + onChange={vi.fn()} + value="" />, ); diff --git a/packages/ui/src/FormWidgets/CountryPicker/__test__/__snapshots__/CountryPicker.snapshot.test.tsx.snap b/packages/ui/src/FormWidgets/CountryPicker/__test__/__snapshots__/CountryPicker.snapshot.test.tsx.snap index d85ec78ea..363a99c48 100644 --- a/packages/ui/src/FormWidgets/CountryPicker/__test__/__snapshots__/CountryPicker.snapshot.test.tsx.snap +++ b/packages/ui/src/FormWidgets/CountryPicker/__test__/__snapshots__/CountryPicker.snapshot.test.tsx.snap @@ -67,3 +67,182 @@ exports[`CountryPicker Component > should render correctly with favorites and lo `; + +exports[`CountryPicker Component Snapshots > renders simple list correctly 1`] = ` +
+
+
+
+ + Nepal + + + + + +
+
+
+
+`; + +exports[`CountryPicker Component Snapshots > renders with custom flag path function 1`] = ` +
+
+
+
+
+ +
+ + + +
+
+
+
+`; + +exports[`CountryPicker Component Snapshots > renders with favorites and custom labels 1`] = ` +
+
+
+
+ + France + + + + + +
+
+
+
+`; + +exports[`CountryPicker Component Snapshots > renders with flag options disabled 1`] = ` +
+
+
+
+
+ +
+ + + +
+
+
+
+`; + +exports[`CountryPicker Component Snapshots > renders with grouped countries 1`] = ` +
+
+
+
+
+ +
+ + + +
+
+
+
+`;