mirror of
https://github.com/SigNoz/signoz.git
synced 2026-03-14 17:12:15 +00:00
feat: enhance navigation tests for middle mouse button interactions
This commit is contained in:
@@ -20,6 +20,7 @@ describe('navigation utilities', () => {
|
||||
({
|
||||
metaKey: false,
|
||||
ctrlKey: false,
|
||||
button: 0,
|
||||
...overrides,
|
||||
} as MouseEvent);
|
||||
|
||||
@@ -50,6 +51,11 @@ describe('navigation utilities', () => {
|
||||
} as Partial<MouseEvent>);
|
||||
expect(isModifierKeyPressed(event)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true when middle mouse button is used', () => {
|
||||
const event = createMouseEvent({ button: 1 });
|
||||
expect(isModifierKeyPressed(event)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('openInNewTab', () => {
|
||||
@@ -98,6 +104,14 @@ describe('navigation utilities', () => {
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('opens new tab when middle mouse button is used', () => {
|
||||
const event = { metaKey: false, ctrlKey: false, button: 1 } as MouseEvent;
|
||||
navigateToPage('/services', mockNavigate, event);
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith('/services', '_blank');
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('calls navigate callback when no modifier key is pressed', () => {
|
||||
const event = { metaKey: false, ctrlKey: false } as MouseEvent;
|
||||
navigateToPage('/services', mockNavigate, event);
|
||||
|
||||
Reference in New Issue
Block a user