diff --git a/frontend/src/screens/HomeScreen.tsx b/frontend/src/screens/HomeScreen.tsx
index da4a7f3..2372f1b 100644
--- a/frontend/src/screens/HomeScreen.tsx
+++ b/frontend/src/screens/HomeScreen.tsx
@@ -96,6 +96,16 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
{
+ if ((event.target as HTMLElement).closest('button, a, input')) {
+ return;
+ }
+ void onSelect(profile.npub);
+ }
+ }
>
{
.click(screen.getByRole('button', { name: /Create your first profile/i }));
expect(onCreateProfile).toHaveBeenCalled();
});
+
+ it('selects a profile when its row is clicked (not just the Select button)', async () => {
+ const backend = createFakeBackend();
+ renderHome(backend);
+ renderWithApp();
+
+ const bobRow = (await screen.findByText('Bob')).closest('.home-profile-row') as HTMLElement;
+ // Clicking the name (not the Select button) should select the profile.
+ await userEvent.setup().click(within(bobRow).getByText('Bob'));
+
+ await waitFor(() => {
+ expect(within(bobRow).getByRole('button', { name: 'Selected' })).toBeInTheDocument();
+ });
+ // The previously active profile now offers a Select button again.
+ const aliceRow = screen.getByText('Alice').closest('.home-profile-row') as HTMLElement;
+ expect(within(aliceRow).getByRole('button', { name: 'Select' })).toBeInTheDocument();
+ });
});