import { describe, it, expect } from 'vitest';
import { extractModifiers } from '../gestures/normalize';
import { NO_MODIFIERS } from '../gestures/types';

describe('gesture normalize', () => {
	describe('extractModifiers', () => {
		it('returns NO_MODIFIERS when none pressed', () => {
			const result = extractModifiers({
				shiftKey: false,
				ctrlKey: false,
				altKey: false,
				metaKey: false,
			});
			expect(result).toBe(NO_MODIFIERS);
		});

		it('extracts shift', () => {
			const result = extractModifiers({
				shiftKey: true,
				ctrlKey: false,
				altKey: false,
				metaKey: false,
			});
			expect(result.shift).toBe(true);
			expect(result.ctrl).toBe(false);
		});

		it('extracts ctrl + alt combo', () => {
			const result = extractModifiers({
				shiftKey: false,
				ctrlKey: true,
				altKey: true,
				metaKey: false,
			});
			expect(result.ctrl).toBe(true);
			expect(result.alt).toBe(true);
		});

		it('extracts meta (Command on macOS)', () => {
			const result = extractModifiers({
				shiftKey: false,
				ctrlKey: false,
				altKey: false,
				metaKey: true,
			});
			expect(result.meta).toBe(true);
		});
	});
});
