Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(lab): the reorder-grip pinch spec runs for the grips it renders (#10736)

Cindy Zhang4fbef8a6bb94
diff --git a/.github/scripts/a11y-pr-contracts.test.mjs b/.github/scripts/a11y-pr-contracts.test.mjs
index c2bfde17d8..fa9c8ffaf8 100644
--- a/.github/scripts/a11y-pr-contracts.test.mjs
+++ b/.github/scripts/a11y-pr-contracts.test.mjs
@@ -1259,6 +1259,45 @@ describe('repository specs', () => {
expect(files.length).toBeGreaterThan(100);
});
+ it('runs the reorder-grip pinch spec only for the grips it renders', () => {
+ const file =
+ 'packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts';
+ const routing = parseRouting(
+ fs.readFileSync(path.join(root, file), 'utf8'),
+ );
+ const selects = changedPaths =>
+ selectSpecs({
+ specs: [{file, routing}],
+ isPullRequest: true,
+ changedPaths,
+ components: [],
+ title: '',
+ }).length > 0;
+ for (const changed of [
+ 'packages/lab/src/reorderStyles.ts',
+ 'packages/lab/src/ListInput/ListInput.tsx',
+ 'packages/lab/src/TransferList/TransferList.tsx',
+ 'packages/core/src/List/listReorderEngine.tsx',
+ 'packages/core/src/internal/reorder.ts',
+ 'packages/core/src/reorderable/createReorderable.ts',
+ 'packages/core/src/gestures/GestureHost.ts',
+ 'packages/core/src/gestures/LongPressGestureRecognizer.ts',
+ 'packages/core/src/motion/uikit/reorder.ts',
+ 'apps/storybook/stories/TransferListA11y.stories.tsx',
+ 'apps/storybook/stories/ListInput.stories.tsx',
+ ]) {
+ expect(selects([changed]), changed).toBe(true);
+ }
+ for (const changed of [
+ 'packages/lab/src/Tokenizer/Tokenizer.tsx',
+ 'packages/core/src/Drawer/Drawer.tsx',
+ 'packages/core/src/hooks/useScrollableArea.ts',
+ 'apps/storybook/stories/SideNav.stories.tsx',
+ ]) {
+ expect(selects([changed]), changed).toBe(false);
+ }
+ });
+
it('gives every spec valid routing lines', () => {
for (const file of files) {
expect(
diff --git a/packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts b/packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts
index 8da5731b79..42fca2af3f 100644
--- a/packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts
+++ b/packages/lab/src/__tests__/ReorderGripPinchZoom.a11y.chromium.spec.ts
@@ -1,5 +1,5 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
-// @pr-a11y always
+// @pr-a11y scope ^(packages/lab/src/(reorderStyles\.ts|ListInput/|TransferList/)|packages/core/src/(List/|internal/reorder|reorderable/|gestures/(GestureHost|LongPressGestureRecognizer)\.ts|motion/uikit/reorder\.ts)|apps/storybook/stories/(ListInput|TransferList[A-Za-z0-9]*)\.stories)
/**
* @file ReorderGripPinchZoom.a11y.chromium.spec.ts