“{nicknames.map(n => n.name).join(", ")}”
)} From f39f10d5932a5ae3dcafb4ad5e6bdc26f2e17b8a Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 4 Nov 2026 11:05:37 +0100 Subject: [PATCH 5/6] fix: mark the contact a menu is for, and no member on a group's page --- .../contacts/__tests__/contacts-app.test.tsx | 12 ++++ .../__tests__/contacts-ux-pim.test.tsx | 61 +++++++++++++++++++ components/contacts/contact-group-detail.tsx | 5 +- components/contacts/contact-list-item.tsx | 7 ++- components/contacts/contact-list.tsx | 1 + components/contacts/contacts-app.tsx | 3 +- 6 files changed, 82 insertions(+), 7 deletions(-) diff --git a/components/contacts/__tests__/contacts-app.test.tsx b/components/contacts/__tests__/contacts-app.test.tsx index 7d8ba656b..31f533ba1 100644 --- a/components/contacts/__tests__/contacts-app.test.tsx +++ b/components/contacts/__tests__/contacts-app.test.tsx @@ -307,4 +307,16 @@ describe('ContactsApp', () => { fireEvent.click(screen.getByText('context_menu.duplicate')); await waitFor(() => expect(useToastStore.getState().toasts.at(-1)?.title).toBe('toast.error_create')); }); + + it("marks no member in the list on a group's page, even with a contact open before", () => { + const team: ContactCard = { id: 'g-team', addressBookIds: {}, kind: 'group', name: { full: 'Team' }, members: { 'c-alice': true, 'c-bob': true } }; + renderContacts([alice, bob, team]); + fireEvent.click(screen.getByText('Alice Smith')); + expect(document.querySelector('[data-contact-id="c-alice"]')).toHaveAttribute('aria-selected', 'true'); + fireEvent.click(screen.getAllByRole('button', { name: 'open_categories' })[0]); + fireEvent.click(within(drawer()).getByText('Team')); + expect(screen.getByText('groups.members_label')).toBeInTheDocument(); + expect(document.querySelector('[data-contact-id="c-alice"]')).toHaveAttribute('aria-selected', 'false'); + expect(document.querySelectorAll('[data-contact-id][aria-selected="true"]')).toHaveLength(0); + }); }); diff --git a/components/contacts/__tests__/contacts-ux-pim.test.tsx b/components/contacts/__tests__/contacts-ux-pim.test.tsx index c0dbef52c..496ca5a72 100644 --- a/components/contacts/__tests__/contacts-ux-pim.test.tsx +++ b/components/contacts/__tests__/contacts-ux-pim.test.tsx @@ -20,6 +20,8 @@ vi.mock('@/components/contacts/contact-activity', () => ({ ContactActivity: () = import { ContactForm } from '../contact-form'; import { ContactDetail } from '../contact-detail'; import { ContactsSidebar } from '../contacts-sidebar'; +import { ContactList } from '../contact-list'; +import { ContactGroupDetail } from '../contact-group-detail'; const anna: ContactCard = { id: 'c1', @@ -28,6 +30,12 @@ const anna: ContactCard = { emails: { e0: { address: 'anna@example.net', contexts: { private: true } } }, phones: { p0: { number: '+49 30 1', features: { voice: true }, contexts: { private: true } } }, }; +const ben: ContactCard = { + id: 'c2', + addressBookIds: {}, + name: { components: [{ kind: 'given', value: 'Ben' }, { kind: 'surname', value: 'Muster' }], isOrdered: true }, + emails: { e0: { address: 'ben@example.net' } }, +}; describe('pim-19: standard words read as people say them', () => { it('offers "Phone" and "Home" in the editor, storing voice and private as before', () => { @@ -122,3 +130,56 @@ describe('pim-26: the Contacts menus', () => { expect(within(menu).getByText('ux_pim_contact.new_address_book_menu')).toBeInTheDocument(); }); }); + +const listProps = { + contacts: [anna, ben], + searchQuery: '', + onSearchChange: vi.fn(), + onSelectContact: vi.fn(), + onCreateNew: vi.fn(), + selectedContactIds: new Set