From e060f61109de1ed1d7c6000f636d479ad908ff4f Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:40:08 +0200 Subject: [PATCH 1/2] fix(tmp): open customize on profile menu settings --- .../src/components/ProfileMenu/sections/AccountSection.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/components/ProfileMenu/sections/AccountSection.tsx b/packages/shared/src/components/ProfileMenu/sections/AccountSection.tsx index 5fd67db6017..f1768c5af44 100644 --- a/packages/shared/src/components/ProfileMenu/sections/AccountSection.tsx +++ b/packages/shared/src/components/ProfileMenu/sections/AccountSection.tsx @@ -4,14 +4,19 @@ import type { ReactElement } from 'react'; import { ProfileSection } from '../ProfileSection'; import { CreditCardIcon, InviteIcon, SettingsIcon } from '../../icons'; import { webappUrl } from '../../../lib/constants'; +import { useLazyModal } from '../../../hooks/useLazyModal'; +import { LazyModal } from '../../modals/common/types'; export const AccountSection = (): ReactElement => { + const { openModal } = useLazyModal(); + return ( openModal({ type: LazyModal.UserSettings }), icon: , }, { From b413e3eeea4e4f56f1fb36e73e8bce6545dd2374 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Wed, 16 Apr 2025 17:09:20 +0200 Subject: [PATCH 2/2] test: fix test --- .../components/profile/ProfileButton.spec.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/shared/src/components/profile/ProfileButton.spec.tsx b/packages/shared/src/components/profile/ProfileButton.spec.tsx index 605913dbb7f..94dfe971eb8 100644 --- a/packages/shared/src/components/profile/ProfileButton.spec.tsx +++ b/packages/shared/src/components/profile/ProfileButton.spec.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { QueryClient } from '@tanstack/react-query'; import type { RenderResult } from '@testing-library/react'; -import { waitFor, render, screen } from '@testing-library/react'; +import { waitFor, render, screen, act } from '@testing-library/react'; import ProfileButton from './ProfileButton'; import defaultUser from '../../../__tests__/fixture/loggedUser'; import { TestBootProvider } from '../../../__tests__/helpers/boot'; @@ -32,21 +32,27 @@ const renderComponent = (): RenderResult => { ); }; -it('account details should link to account profile page', async () => { +it('should show settings option that opens modal', async () => { renderComponent(); const profileBtn = await screen.findByLabelText('Profile settings'); - profileBtn.click(); - - const accountLink = await screen.findByRole('link', { name: 'Settings' }); - expect(accountLink).toHaveAttribute('href', '/account/profile'); + await act(async () => { + profileBtn.click(); + }); + + const settingsButton = await screen.findByRole('button', { + name: 'Settings', + }); + expect(settingsButton).toBeInTheDocument(); }); it('should click the logout button and logout', async () => { renderComponent(); const profileBtn = await screen.findByLabelText('Profile settings'); - profileBtn.click(); + await act(async () => { + profileBtn.click(); + }); const logoutBtn = await screen.findByText('Logout'); logoutBtn.click();