Skip to content

Commit 7dcc2fe

Browse files
PeerRichdevin-ai-integration[bot]pasqualevitiello
authored
feat: add multi-step download app dropdown with platform-specific options (calcom#27211)
Co-authored-by: peer@cal.com <peer@cal.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: pasqualevitiello <pasqualevitiello@gmail.com>
1 parent a359f0b commit 7dcc2fe

8 files changed

Lines changed: 1151 additions & 161 deletions

File tree

apps/web/modules/shell/user-dropdown/DownloadIcons.tsx

Lines changed: 625 additions & 0 deletions
Large diffs are not rendered by default.

apps/web/modules/shell/user-dropdown/UserDropdown.test.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ vi.mock("@calcom/lib/hooks/useLocale", () => ({
1616
}),
1717
}));
1818

19+
vi.mock("@calcom/lib/hooks/useUserAgentData", () => ({
20+
useUserAgentData: () => ({
21+
os: "linux",
22+
browser: "chrome",
23+
isMobile: false,
24+
}),
25+
}));
26+
1927
const mockUseMeQuery = vi.fn();
2028
vi.mock("@calcom/trpc/react/hooks/useMeQuery", () => ({
2129
default: () => mockUseMeQuery(),
@@ -39,14 +47,20 @@ vi.mock("@calcom/ui/components/icon", () => ({
3947
Icon: ({ name }: { name: string }) => <span data-testid={`icon-${name}`}>{name}</span>,
4048
}));
4149

42-
vi.mock("@calcom/ui/components/dropdown", () => ({
43-
Dropdown: ({ children }: { children: React.ReactNode }) => <div data-testid="dropdown">{children}</div>,
44-
DropdownItem: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
45-
DropdownMenuContent: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
46-
DropdownMenuItem: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
47-
DropdownMenuPortal: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
48-
DropdownMenuSeparator: () => <hr />,
49-
DropdownMenuTrigger: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
50+
vi.mock("@coss/ui/components/menu", () => ({
51+
Menu: ({ children }: { children: React.ReactNode }) => <div data-testid="menu">{children}</div>,
52+
MenuTrigger: ({ children, render }: { children: React.ReactNode; render?: React.ReactElement }) => {
53+
if (render) {
54+
return React.cloneElement(render, {}, children);
55+
}
56+
return <div>{children}</div>;
57+
},
58+
MenuPopup: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
59+
MenuItem: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
60+
MenuSeparator: () => <hr />,
61+
MenuSub: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
62+
MenuSubTrigger: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
63+
MenuSubPopup: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
5064
}));
5165

5266
vi.mock("@calcom/ui/classNames", () => ({
@@ -232,7 +246,7 @@ describe("UserDropdown", () => {
232246
const { UserDropdown } = await import("./UserDropdown");
233247
const { getByTestId } = render(<UserDropdown />);
234248

235-
expect(getByTestId("dropdown")).toBeInTheDocument();
249+
expect(getByTestId("menu")).toBeInTheDocument();
236250
});
237251

238252
it("should render dropdown when isPending is true (loading state)", async () => {
@@ -244,7 +258,7 @@ describe("UserDropdown", () => {
244258
const { UserDropdown } = await import("./UserDropdown");
245259
const { getByTestId } = render(<UserDropdown />);
246260

247-
expect(getByTestId("dropdown")).toBeInTheDocument();
261+
expect(getByTestId("menu")).toBeInTheDocument();
248262
});
249263
});
250264
});

0 commit comments

Comments
 (0)