diff --git a/src/components/email/MessageContent.tsx b/src/components/email/MessageContent.tsx index e974306b..5b17d377 100644 --- a/src/components/email/MessageContent.tsx +++ b/src/components/email/MessageContent.tsx @@ -6,6 +6,7 @@ import { useColors } from '../../theme/colors'; import { useSettingsStore } from '../../stores/settings-store'; import EmailBodyView from '../EmailBodyView'; import { CalendarInvitationBanner } from './CalendarInvitationBanner'; +import { StructuredMailBanner } from './structured-mail/StructuredMailBanner'; import { MessageHeader } from './MessageHeader'; import { AttachmentChips } from './AttachmentChips'; import { UnsubscribeBanner } from './UnsubscribeBanner'; @@ -114,6 +115,7 @@ export function MessageContent({ )} + {deferBody ? ( diff --git a/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts b/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts new file mode 100644 index 00000000..81f54f28 --- /dev/null +++ b/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from 'vitest'; +import fs from 'node:fs'; +import path from 'node:path'; + +// The booking, parcel and order cards only show if the reader renders the +// banner. The webmail draws them above the body, after the invitation banner +// (components/email/email-viewer.tsx:2695). The banner itself is tested in +// structured-mail-banner.test.ts; this checks the reader mounts it. + +const messageContent = () => + fs.readFileSync(path.resolve(__dirname, '..', '..', 'MessageContent.tsx'), 'utf8'); + +describe('structured mail mount', () => { + it('renders the cards banner after the invitation banner, for the same account', () => { + const src = messageContent(); + expect(src).toMatch(/import \{ StructuredMailBanner \} from '\.\/structured-mail\/StructuredMailBanner';/); + const invitation = src.indexOf(''); + const cards = src.indexOf(''); + expect(invitation).toBeGreaterThan(-1); + expect(cards).toBeGreaterThan(invitation); + }); +});