fix(mobile): harden back gestures and repair CI regressions

Reflect the drag position in the sheet scrim and match back gestures to the reading direction. Keep Escape on the top overlay and update failing tests for the redesigned forms, navigation, and offline preparation. Remove dead exports and lower obsolete lint counts.
This commit is contained in:
Maurice
2026-12-03 23:30:26 +01:00
parent 4b54a00d89
commit faaa56eda6
39 changed files with 171 additions and 136 deletions
@@ -33,11 +33,40 @@ beforeEach(() => {
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 400 });
});
afterEach(() => {
document.documentElement.removeAttribute('dir');
vi.useRealTimers();
vi.clearAllMocks();
});
describe('MEdgeBack', () => {
it('mirrors the swipe from the right edge in a right-to-left interface', () => {
document.documentElement.dir = 'rtl';
const back = vi.spyOn(window.history, 'back').mockImplementation(() => {});
const { getByTestId } = render(<Host />);
touch('touchstart', 395, 300, 0);
touch('touchmove', 220, 300, 100);
expect(getByTestId('page').style.transform).toBe('translateX(-175px)');
touch('touchend', 220, 300, 150);
vi.advanceTimersByTime(280);
expect(back).toHaveBeenCalledTimes(1);
});
it('drops a scheduled back navigation if the history changes first', () => {
const back = vi.spyOn(window.history, 'back').mockImplementation(() => {});
const { getByTestId } = render(<Host />);
touch('touchstart', 5, 300, 0);
touch('touchmove', 200, 300, 100);
touch('touchend', 200, 300, 150);
window.dispatchEvent(new PopStateEvent('popstate'));
vi.advanceTimersByTime(280);
expect(getByTestId('page').style.transform).toBe('');
expect(back).not.toHaveBeenCalled();
});
it('drags the page with a finger from the left edge, and goes back past a third', () => {
const back = vi.spyOn(window.history, 'back').mockImplementation(() => {});
const { getByTestId } = render(<Host />);