Files
hive/frontend/node_modules/@testing-library/user-event/dist/esm/keyboard/keyMap.js
anthonyrawlins aacb45156b Set up comprehensive frontend testing infrastructure
- Install Jest for unit testing with React Testing Library
- Install Playwright for end-to-end testing
- Configure Jest with proper TypeScript support and module mapping
- Create test setup files and utilities for both unit and e2e tests

Components:
* Jest configuration with coverage thresholds
* Playwright configuration with browser automation
* Unit tests for LoginForm, AuthContext, and useSocketIO hook
* E2E tests for authentication, dashboard, and agents workflows
* GitHub Actions workflow for automated testing
* Mock data and API utilities for consistent testing
* Test documentation with best practices

Testing features:
- Unit tests with 70% coverage threshold
- E2E tests with API mocking and user journey testing
- CI/CD integration for automated test runs
- Cross-browser testing support with Playwright
- Authentication system testing end-to-end

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-11 14:06:34 +10:00

177 lines
3.3 KiB
JavaScript

import { DOM_KEY_LOCATION } from '../system/keyboard.js';
/**
* Mapping for a default US-104-QWERTY keyboard
*/ const defaultKeyMap = [
// alphanumeric block - writing system
...'0123456789'.split('').map((c)=>({
code: `Digit${c}`,
key: c
})),
...')!@#$%^&*('.split('').map((c, i)=>({
code: `Digit${i}`,
key: c,
shiftKey: true
})),
...'abcdefghijklmnopqrstuvwxyz'.split('').map((c)=>({
code: `Key${c.toUpperCase()}`,
key: c
})),
...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('').map((c)=>({
code: `Key${c}`,
key: c,
shiftKey: true
})),
{
code: 'BracketLeft',
key: '['
},
{
code: 'BracketLeft',
key: '{',
shiftKey: true
},
{
code: 'BracketRight',
key: ']'
},
{
code: 'BracketRight',
key: '}',
shiftKey: true
},
// alphanumeric block - functional
{
code: 'Space',
key: ' '
},
{
code: 'AltLeft',
key: 'Alt',
location: DOM_KEY_LOCATION.LEFT
},
{
code: 'AltRight',
key: 'Alt',
location: DOM_KEY_LOCATION.RIGHT
},
{
code: 'ShiftLeft',
key: 'Shift',
location: DOM_KEY_LOCATION.LEFT
},
{
code: 'ShiftRight',
key: 'Shift',
location: DOM_KEY_LOCATION.RIGHT
},
{
code: 'ControlLeft',
key: 'Control',
location: DOM_KEY_LOCATION.LEFT
},
{
code: 'ControlRight',
key: 'Control',
location: DOM_KEY_LOCATION.RIGHT
},
{
code: 'MetaLeft',
key: 'Meta',
location: DOM_KEY_LOCATION.LEFT
},
{
code: 'MetaRight',
key: 'Meta',
location: DOM_KEY_LOCATION.RIGHT
},
{
code: 'OSLeft',
key: 'OS',
location: DOM_KEY_LOCATION.LEFT
},
{
code: 'OSRight',
key: 'OS',
location: DOM_KEY_LOCATION.RIGHT
},
{
code: 'ContextMenu',
key: 'ContextMenu'
},
{
code: 'Tab',
key: 'Tab'
},
{
code: 'CapsLock',
key: 'CapsLock'
},
{
code: 'Backspace',
key: 'Backspace'
},
{
code: 'Enter',
key: 'Enter'
},
// function
{
code: 'Escape',
key: 'Escape'
},
// arrows
{
code: 'ArrowUp',
key: 'ArrowUp'
},
{
code: 'ArrowDown',
key: 'ArrowDown'
},
{
code: 'ArrowLeft',
key: 'ArrowLeft'
},
{
code: 'ArrowRight',
key: 'ArrowRight'
},
// control pad
{
code: 'Home',
key: 'Home'
},
{
code: 'End',
key: 'End'
},
{
code: 'Delete',
key: 'Delete'
},
{
code: 'PageUp',
key: 'PageUp'
},
{
code: 'PageDown',
key: 'PageDown'
},
// Special keys that are not part of a default US-layout but included for specific behavior
{
code: 'Fn',
key: 'Fn'
},
{
code: 'Symbol',
key: 'Symbol'
},
{
code: 'AltRight',
key: 'AltGraph'
}
];
export { defaultKeyMap };