mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 08:15:41 +00:00
test: make the sub-address Escape test fail when the key reaches the composer
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user