From 45a7f2ec6a79912be2992378ab9f157fbe8a88e0 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:30:02 +0100 Subject: [PATCH] fix: show an HTML-only signature in the identity list --- .../identity-list-signature.test.tsx | 41 +++++++++++++++++++ .../identity/identity-manager-modal.tsx | 6 ++- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 components/identity/__tests__/identity-list-signature.test.tsx diff --git a/components/identity/__tests__/identity-list-signature.test.tsx b/components/identity/__tests__/identity-list-signature.test.tsx new file mode 100644 index 000000000..d0aba1e38 --- /dev/null +++ b/components/identity/__tests__/identity-list-signature.test.tsx @@ -0,0 +1,41 @@ +import { render, screen } from '@testing-library/react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { IdentityManagerModal } from '@/components/identity/identity-manager-modal'; +import { useAuthStore } from '@/stores/auth-store'; +import { useIdentityStore } from '@/stores/identity-store'; + +// The identity list shows each identity's signature. One set only as HTML +// showed as no signature at all; it shows as its text, without tags. + +vi.mock('@/stores/toast-store', () => ({ + toast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() }, +})); + +describe('identity list signature', () => { + const initial = { auth: useAuthStore.getState(), identity: useIdentityStore.getState() }; + beforeEach(() => { + useAuthStore.setState({ client: null, refreshIdentities: vi.fn(), syncIdentities: vi.fn() } as never); + }); + afterEach(() => { + useAuthStore.setState(initial.auth, true); + useIdentityStore.setState(initial.identity, true); + }); + + it('shows an HTML-only signature as text', () => { + useIdentityStore.setState({ + identities: [{ id: 'i1', name: 'Work', email: 'work@example.com', textSignature: '', htmlSignature: '
Best, Ann
', mayDelete: true }], + } as never); + render(- {t('display.signature')} {identity.textSignature} + {t('display.signature')} {getPlainTextSignature(identity)}
)}