feat(FN-1888): add mobile-ready MailboxView with agents load and styles
- Load agents on mount for compose from any MailboxView tab - Add .mailbox-view base styles for full-page layout - Add .mailbox-view mobile overrides with safe-area-inset handling - Add MailboxView test coverage for compose from inbox with agents
This commit is contained in:
@@ -220,6 +220,11 @@ export function MailboxView({
|
||||
refreshUnreadCount();
|
||||
}, [refreshUnreadCount]);
|
||||
|
||||
// Load agents on mount so they're available for compose from any tab (not just agents tab)
|
||||
useEffect(() => {
|
||||
loadAgents();
|
||||
}, [loadAgents]);
|
||||
|
||||
// ── Actions ───────────────────────────────────────────────────────────
|
||||
|
||||
const handleOpenMessage = useCallback(async (message: Message) => {
|
||||
|
||||
@@ -445,4 +445,38 @@ describe("MailboxView", () => {
|
||||
expect(onUnreadCountChange).toHaveBeenCalledWith(5);
|
||||
});
|
||||
});
|
||||
|
||||
it("shows MessageComposer with agents when clicking compose FAB from inbox tab", async () => {
|
||||
mockFetchInbox.mockResolvedValue({
|
||||
messages: [],
|
||||
unreadCount: 0,
|
||||
});
|
||||
|
||||
render(<MailboxView {...defaultProps} />);
|
||||
|
||||
// Verify compose FAB is visible in inbox tab
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId("mailbox-compose-fab")).toBeDefined();
|
||||
});
|
||||
|
||||
// Click compose FAB
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByTestId("mailbox-compose-fab"));
|
||||
});
|
||||
|
||||
// Verify MessageComposer is shown
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId("message-composer")).toBeDefined();
|
||||
});
|
||||
|
||||
// Verify agents are available (not "No agents available")
|
||||
// The select should have agents as options, not just the placeholder
|
||||
const recipientSelect = screen.getByTestId("message-composer-recipient");
|
||||
expect(recipientSelect).toBeDefined();
|
||||
// Should have agents option, not just "No agents available" placeholder
|
||||
expect(screen.queryByText("No agents available")).toBeNull();
|
||||
// Should show the mock agents
|
||||
expect(screen.getByText("Test Agent 1")).toBeDefined();
|
||||
expect(screen.getByText("Test Agent 2")).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user