import { describe, expect, it } from 'vitest' import { isPlainPrimaryClick } from '@/lib/isPlainPrimaryClick' const click = (overrides: Partial = {}) => ({ button: 0, metaKey: false, ctrlKey: false, shiftKey: false, altKey: false, defaultPrevented: false, ...overrides, }) as MouseEvent describe('isPlainPrimaryClick', () => { it('accepts a normal left click', () => { expect(isPlainPrimaryClick(click())).toBe(true) }) it('rejects modified or non-primary clicks', () => { expect(isPlainPrimaryClick(click({ metaKey: true }))).toBe(false) expect(isPlainPrimaryClick(click({ ctrlKey: true }))).toBe(false) expect(isPlainPrimaryClick(click({ shiftKey: true }))).toBe(false) expect(isPlainPrimaryClick(click({ altKey: true }))).toBe(false) expect(isPlainPrimaryClick(click({ button: 1 }))).toBe(false) expect(isPlainPrimaryClick(click({ defaultPrevented: true }))).toBe(false) }) })