mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 07:40:59 +00:00
4641788fc9
- agent loop and decisions without await in loops: steps as recursion, calls and applied changes in order through one promise chain, the independent reads and claims in parallel; part mapping in its own helpers - place card, header and weather strip without refs or components created in render; long hooks and components split; state reset during render - trip notes only in a turn's tool session, never an undo's; map view reported only while the assistant can run - place strip scrolls through the strip's own smooth scroll, no physical side - tests follow the raised limits and the new card fields; toasts read through a mocked useToast instead of a window global; baselines lowered where the counts fell
27 lines
1008 B
TypeScript
27 lines
1008 B
TypeScript
/**
|
|
* FE-KBD-001 to FE-KBD-002
|
|
*/
|
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
import { render } from '../../../tests/helpers/render';
|
|
import { isApplePlatform } from '../../utils/applePlatform';
|
|
import Kbd from './Kbd';
|
|
|
|
afterEach(() => vi.restoreAllMocks());
|
|
|
|
describe('Kbd', () => {
|
|
it('FE-KBD-001: draws one key chip per key, in order, inside one kbd', () => {
|
|
const { container } = render(<Kbd keys={['Ctrl', 'K']} />);
|
|
const kbd = container.querySelector('kbd');
|
|
expect(kbd).not.toBeNull();
|
|
expect(Array.from(kbd?.children ?? []).map((k) => k.textContent)).toEqual(['Ctrl', 'K']);
|
|
});
|
|
|
|
it('FE-KBD-002: reads the platform off the user agent', () => {
|
|
vi.spyOn(navigator, 'userAgent', 'get').mockReturnValue('Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)');
|
|
expect(isApplePlatform()).toBe(true);
|
|
vi.spyOn(navigator, 'userAgent', 'get').mockReturnValue('Mozilla/5.0 (Windows NT 10.0; Win64; x64)');
|
|
expect(isApplePlatform()).toBe(false);
|
|
});
|
|
});
|