moving
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled

This commit is contained in:
Oleg Maslov
2026-09-02 10:10:29 +02:00
commit 0c3e2ead3b
3841 changed files with 970576 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/**
* KeyboardShortcutsHelp (Pillar 2.7, Lane K) — the discoverable cheat sheet.
* Pins that the new power-path shortcuts and the keyboard-first reveal tip are
* documented, and that the close control carries a ≥40px hit area.
*/
import { describe, it, expect, afterEach } from 'vitest';
import { render, screen, cleanup } from '@testing-library/react';
import KeyboardShortcutsHelp from '@/components/os/overlays/KeyboardShortcutsHelp';
afterEach(() => cleanup());
describe('KeyboardShortcutsHelp', () => {
it('renders nothing when closed', () => {
const { container } = render(<KeyboardShortcutsHelp open={false} onClose={() => {}} />);
expect(container.firstChild).toBeNull();
});
it('documents the new-chat and open-last-workspace power paths', () => {
render(<KeyboardShortcutsHelp open onClose={() => {}} />);
expect(screen.getByText('New chat')).toBeTruthy();
expect(screen.getByText('Open last workspace')).toBeTruthy();
});
it('lists the "?" cheat-sheet trigger', () => {
render(<KeyboardShortcutsHelp open onClose={() => {}} />);
// The Keyboard Shortcuts row is keyed to the discoverable bare "?".
const kbds = screen.getAllByText('?');
expect(kbds.length).toBeGreaterThan(0);
});
it('surfaces the keyboard-first reveal tip (Tab reaches card & row actions)', () => {
render(<KeyboardShortcutsHelp open onClose={() => {}} />);
expect(screen.getByText(/Tab reaches every card/i)).toBeTruthy();
});
it('gives the close control a ≥40px hit area (centered 40px ::before)', () => {
render(<KeyboardShortcutsHelp open onClose={() => {}} />);
const close = screen.getByLabelText('Close keyboard shortcuts');
expect(close.className).toContain('relative');
expect(close.className).toContain('before:h-10');
expect(close.className).toContain('before:w-10');
});
});