mirror of
https://github.com/hanzoai/react-drawer.git
synced 2026-10-30 18:23:24 +00:00
* feat: drawer handle * fix: readme * fix type * fix test * feat: expand handle hit area & cancel on long press * extract magic number * fix: reversed styles * feat: handle drag * remove margin * fix tests * fix conflicts * revert This reverts commit 6692eeb81b6ac7ee524730fa0ec351aa2f4f91ab. * improve undefined checks * add small click delay to more reliably detect double taps
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { ANIMATION_DURATION } from './constants';
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/with-handle');
|
|
});
|
|
|
|
test.describe('With handle', () => {
|
|
test('click should cycle to the next snap point', async ({ page }) => {
|
|
await page.waitForTimeout(ANIMATION_DURATION);
|
|
|
|
await expect(page.getByTestId('content')).toBeVisible();
|
|
await expect(page.getByTestId('active-snap-index')).toHaveText('0');
|
|
|
|
await page.getByTestId('handle').click();
|
|
await expect(page.getByTestId('active-snap-index')).toHaveText('1');
|
|
|
|
await page.getByTestId('handle').click();
|
|
await expect(page.getByTestId('content')).not.toBeVisible();
|
|
});
|
|
|
|
test('double click should close the drawer', async ({ page }) => {
|
|
await page.waitForTimeout(ANIMATION_DURATION);
|
|
|
|
await expect(page.getByTestId('content')).toBeVisible();
|
|
await expect(page.getByTestId('active-snap-index')).toHaveText('0');
|
|
await page.getByTestId('handle').dispatchEvent("dblclick");
|
|
|
|
await page.waitForTimeout(ANIMATION_DURATION);
|
|
await expect(page.getByTestId('content')).not.toBeVisible();
|
|
});
|
|
});
|