Show dismiss 'X' on the Jump to Unread

This commit is contained in:
Jack Kingsman
2026-03-12 20:23:38 -07:00
parent 1c57e35ba5
commit 276e0e09b3
2 changed files with 48 additions and 11 deletions
+23
View File
@@ -162,6 +162,29 @@ describe('MessageList channel sender rendering', () => {
expect(scrollIntoViewMock).toHaveBeenCalled();
});
it('lets the user dismiss the jump-to-unread button without scrolling or hiding the marker', async () => {
const user = userEvent.setup();
const messages = [
createMessage({ id: 1, received_at: 1700000001, text: 'Alice: older' }),
createMessage({ id: 2, received_at: 1700000010, text: 'Alice: newer' }),
];
render(
<MessageList
messages={messages}
contacts={[]}
loading={false}
unreadMarkerLastReadAt={1700000005}
/>
);
await user.click(screen.getByRole('button', { name: 'Dismiss jump to unread' }));
expect(screen.queryByRole('button', { name: 'Jump to unread' })).not.toBeInTheDocument();
expect(screen.getByText('Unread messages')).toBeInTheDocument();
expect(scrollIntoViewMock).not.toHaveBeenCalled();
});
it('hides the jump-to-unread button when the unread marker is already visible', () => {
Object.defineProperty(HTMLElement.prototype, 'getBoundingClientRect', {
configurable: true,