mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-02 00:06:23 +00:00
feat: show the booking, parcel and order cards above the message body
This commit is contained in:
@@ -6,6 +6,7 @@ import { useColors } from '../../theme/colors';
|
|||||||
import { useSettingsStore } from '../../stores/settings-store';
|
import { useSettingsStore } from '../../stores/settings-store';
|
||||||
import EmailBodyView from '../EmailBodyView';
|
import EmailBodyView from '../EmailBodyView';
|
||||||
import { CalendarInvitationBanner } from './CalendarInvitationBanner';
|
import { CalendarInvitationBanner } from './CalendarInvitationBanner';
|
||||||
|
import { StructuredMailBanner } from './structured-mail/StructuredMailBanner';
|
||||||
import { MessageHeader } from './MessageHeader';
|
import { MessageHeader } from './MessageHeader';
|
||||||
import { AttachmentChips } from './AttachmentChips';
|
import { AttachmentChips } from './AttachmentChips';
|
||||||
import { UnsubscribeBanner } from './UnsubscribeBanner';
|
import { UnsubscribeBanner } from './UnsubscribeBanner';
|
||||||
@@ -114,6 +115,7 @@ export function MessageContent({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<CalendarInvitationBanner email={email} jmapAccountId={jmapAccountId} />
|
<CalendarInvitationBanner email={email} jmapAccountId={jmapAccountId} />
|
||||||
|
<StructuredMailBanner email={email} jmapAccountId={jmapAccountId} />
|
||||||
|
|
||||||
<View style={[styles.body, fill && styles.fill]}>
|
<View style={[styles.body, fill && styles.fill]}>
|
||||||
{deferBody ? (
|
{deferBody ? (
|
||||||
|
|||||||
@@ -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('<CalendarInvitationBanner email={email} jmapAccountId={jmapAccountId} />');
|
||||||
|
const cards = src.indexOf('<StructuredMailBanner email={email} jmapAccountId={jmapAccountId} />');
|
||||||
|
expect(invitation).toBeGreaterThan(-1);
|
||||||
|
expect(cards).toBeGreaterThan(invitation);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user