fix: GL maps read the stored copy again while offline, and a switch that is on keeps a visible knob in the dark scheme

This commit is contained in:
Maurice
2026-11-08 12:21:52 +01:00
parent 06c03cbded
commit eea83bb1c9
6 changed files with 83 additions and 26 deletions
@@ -0,0 +1,22 @@
import { describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen } from '../../../tests/helpers/render';
import MToggle from './MToggle';
vi.mock('../../native/haptics', () => ({ selectionHaptic: vi.fn() }));
describe('MToggle', () => {
it('FE-MOB-TOGGLE-001: on, the knob takes the track ink so it stays visible on the near-white dark track', () => {
const onChange = vi.fn();
const { rerender } = render(<MToggle checked onChange={onChange} ariaLabel="Offline" />);
const knob = screen.getByRole('switch').firstElementChild as HTMLElement;
expect(knob.className).toContain('bg-[color:var(--m-actfg)]');
expect(knob.className).not.toContain('--m-knob');
rerender(<MToggle checked={false} onChange={onChange} ariaLabel="Offline" />);
expect((screen.getByRole('switch').firstElementChild as HTMLElement).className).toContain(
'bg-[color:var(--m-knob)]'
);
fireEvent.click(screen.getByRole('switch'));
expect(onChange).toHaveBeenCalledWith(true);
});
});