import { expect, test, } from './fixtures'; /** * Slider position is spring-animated; aria-valuenow reflects the current * value, not the target. All assertions use `toHaveAttribute` so Playwright * polls until the spring settles. */ test.describe('comparison slider', () => { test.beforeEach(async ({ comparison }) => { await comparison.pickPair('Inter', 'Roboto'); await comparison.slider.focus(); }); test('keyboard navigation snaps to End and Home', async ({ comparison }) => { await comparison.slider.press('End'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '100'); await comparison.slider.press('Home'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0'); }); test('arrow keys nudge by one, Shift+Arrow by ten', async ({ comparison }) => { await comparison.slider.press('Home'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0'); await comparison.slider.press('ArrowRight'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '1'); await comparison.slider.press('Shift+ArrowRight'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '11'); }); test('PageUp / PageDown move by ten', async ({ comparison }) => { await comparison.slider.press('Home'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0'); await comparison.slider.press('PageUp'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '10'); await comparison.slider.press('PageDown'); await expect(comparison.slider).toHaveAttribute('aria-valuenow', '0'); }); });