test: make the sub-address Escape test fail when the key reaches the composer

This commit is contained in:
Linus Rath
2026-11-03 15:16:45 +01:00
parent 3687363d6e
commit 3eae412e98
@@ -17,6 +17,21 @@ describe('SubAddressHelper', () => {
expect(screen.queryByRole('dialog')).toBeNull();
});
it('keeps that Escape from what is around it, so the composer stays open', () => {
const composerKey = vi.fn();
render(
<div onKeyDown={composerKey}>
<SubAddressHelper baseEmail="nora@example.com" recipientEmails={[]} onSelectTag={() => {}} />
</div>,
);
fireEvent.click(screen.getByTitle('button_tooltip'));
fireEvent.keyDown(screen.getByRole('dialog', { name: 'popover_title' }), { key: 'Escape' });
expect(screen.queryByRole('dialog')).toBeNull();
expect(composerKey).not.toHaveBeenCalled();
});
it('moves back on screen when its button is near the left edge', () => {
const rect = vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue({ left: -80, right: 240 } as DOMRect);
const dialog = open();