@transferwise/components 0.0.0-experimental-89c4b74 → 0.0.0-experimental-32a8cf4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { Field } from '../field/Field';
|
|
|
5
5
|
import { SelectInput, type SelectInputProps } from './SelectInput';
|
|
6
6
|
import { lorem5, lorem500 } from '../test-utils';
|
|
7
7
|
import Body from '../body';
|
|
8
|
+
import { allModes } from '../../.storybook/modes';
|
|
8
9
|
|
|
9
10
|
const meta = {
|
|
10
11
|
title: 'Forms/SelectInput/tests',
|
|
@@ -21,6 +22,11 @@ export default meta;
|
|
|
21
22
|
|
|
22
23
|
type Story<T, M extends boolean = false> = StoryObj<SelectInputProps<T, M>>;
|
|
23
24
|
|
|
25
|
+
const wait = async (duration = 1000) =>
|
|
26
|
+
new Promise<void>((resolve) => {
|
|
27
|
+
setTimeout(resolve, duration);
|
|
28
|
+
});
|
|
29
|
+
|
|
24
30
|
/**
|
|
25
31
|
* This test ensures that when the SelectInput is used within a scrollable page,
|
|
26
32
|
* opening the dropdown does not cause any unwanted scrolling or layout shifts.
|
|
@@ -55,15 +61,25 @@ export const SmoothScrollReset: Story<string> = {
|
|
|
55
61
|
</>
|
|
56
62
|
),
|
|
57
63
|
],
|
|
58
|
-
play: async ({ canvasElement
|
|
59
|
-
|
|
64
|
+
play: async ({ canvasElement }) => {
|
|
65
|
+
document.documentElement.scrollTop = 400;
|
|
66
|
+
document.body.scrollTop = 400;
|
|
67
|
+
window.scrollTo(0, 400);
|
|
68
|
+
window.scroll(0, 400);
|
|
69
|
+
|
|
60
70
|
const canvas = within(canvasElement);
|
|
61
71
|
const triggerButton = canvas.getByRole('combobox');
|
|
62
72
|
await userEvent.click(triggerButton);
|
|
63
73
|
},
|
|
74
|
+
globals: {
|
|
75
|
+
viewport: { value: allModes.largeMobile.viewport, isRotated: false },
|
|
76
|
+
},
|
|
64
77
|
parameters: {
|
|
65
78
|
chromatic: {
|
|
66
|
-
delay:
|
|
79
|
+
delay: 2000,
|
|
80
|
+
modes: {
|
|
81
|
+
largeMobile: allModes.largeMobile,
|
|
82
|
+
}
|
|
67
83
|
},
|
|
68
84
|
},
|
|
69
85
|
};
|