- Add wake lock and browser fullscreen controls to encounter header/popout - Re-acquire wake lock after browser release (still doesnt work on tablet) - Retry fullscreen after Android unlock; keep manual control visible - Add larger labeled character Save button - Use distinct panel icon for encounter full-page expansion - Add strong active/inactive, conditions-open, and editing button states - Keep inactive participant controls visible - Add regression tests and update affected characterization tests - Update project TODO notes
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
import { screen, fireEvent } from '@testing-library/react';
|
|
import '@testing-library/jest-dom';
|
|
import { setupReady, addMonsterViaUI } from './testHelpers';
|
|
|
|
describe('participant action selected states', () => {
|
|
test('active toggle clearly changes to selected inactive state', async () => {
|
|
await setupReady('ActionCamp1', 'ActionEnc1');
|
|
await addMonsterViaUI('Toggle Orc', 15, 3);
|
|
|
|
const disable = screen.getByRole('button', { name: 'Disable participant' });
|
|
expect(disable).toHaveAttribute('aria-pressed', 'true');
|
|
expect(disable).toHaveClass('bg-emerald-700');
|
|
fireEvent.click(disable);
|
|
|
|
const enable = await screen.findByRole('button', { name: 'Enable participant' });
|
|
expect(enable).toHaveAttribute('aria-pressed', 'false');
|
|
expect(enable).toHaveClass('bg-red-900', 'ring-red-500');
|
|
});
|
|
|
|
test('conditions toggle highlights open state and gives close action', async () => {
|
|
await setupReady('ActionCamp2', 'ActionEnc2');
|
|
await addMonsterViaUI('Condition Orc', 15, 3);
|
|
|
|
const open = screen.getByRole('button', { name: 'Open conditions' });
|
|
expect(open).toHaveAttribute('aria-expanded', 'false');
|
|
fireEvent.click(open);
|
|
|
|
const close = screen.getByRole('button', { name: 'Close conditions' });
|
|
expect(close).toHaveAttribute('aria-expanded', 'true');
|
|
expect(close).toHaveClass('bg-purple-700', 'ring-purple-300');
|
|
});
|
|
|
|
test('edit toggle exposes selected state while editor is open', async () => {
|
|
await setupReady('ActionCamp3', 'ActionEnc3');
|
|
await addMonsterViaUI('Edit Orc', 15, 3);
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: 'Edit participant' }));
|
|
const closeEditor = screen.getByRole('button', { name: 'Close participant editor' });
|
|
expect(closeEditor).toHaveAttribute('aria-pressed', 'true');
|
|
expect(closeEditor).toHaveClass('bg-amber-500', 'ring-amber-200');
|
|
});
|
|
});
|