@payfit/unity-components 2.12.6 → 2.12.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CalendarDate } from '@internationalized/date';
|
|
2
1
|
import { PlayCtx } from '../../types/testing.js';
|
|
2
|
+
import { CalendarDate } from '@internationalized/date';
|
|
3
3
|
/**
|
|
4
4
|
* Factory to get date picker testing utils
|
|
5
5
|
* @param context the story context
|
|
@@ -9,4 +9,7 @@ export declare const getTestingUtilsDatePicker: (context: PlayCtx) => {
|
|
|
9
9
|
labelText: string;
|
|
10
10
|
calendarDate: CalendarDate;
|
|
11
11
|
}) => Promise<void>;
|
|
12
|
+
getCalendarDateValue: ({ labelText }: {
|
|
13
|
+
labelText: string;
|
|
14
|
+
}) => CalendarDate;
|
|
12
15
|
};
|
|
@@ -1,35 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { CalendarDate as o } from "@internationalized/date";
|
|
2
|
+
import { userEvent as r, within as l } from "storybook/test";
|
|
3
|
+
const c = (i) => {
|
|
4
|
+
const d = (e) => {
|
|
5
|
+
const t = l(i.canvasElement).getAllByLabelText(
|
|
6
|
+
e,
|
|
7
|
+
{
|
|
8
|
+
exact: !1,
|
|
9
|
+
selector: "span"
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
if (t.length !== 3)
|
|
13
|
+
throw new Error(`Date field for ${e} not found`);
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
fillCalendarDate: async ({
|
|
18
|
+
labelText: e,
|
|
19
|
+
calendarDate: t
|
|
20
|
+
}) => {
|
|
21
|
+
await i.step(`Fill date picker ${e}`, async () => {
|
|
22
|
+
const a = d(e);
|
|
23
|
+
await r.type(
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
25
|
+
a.find((n) => n.getAttribute("data-type") === "day"),
|
|
26
|
+
String(t.day)
|
|
27
|
+
), await r.type(
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
29
|
+
a.find((n) => n.getAttribute("data-type") === "month"),
|
|
30
|
+
String(t.month)
|
|
31
|
+
), await r.type(
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
33
|
+
a.find((n) => n.getAttribute("data-type") === "year"),
|
|
34
|
+
String(t.year)
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
getCalendarDateValue: ({ labelText: e }) => {
|
|
39
|
+
const t = d(e), a = (n) => parseInt(
|
|
40
|
+
t.find((s) => s.getAttribute("data-type") === n)?.textContent ?? ""
|
|
14
41
|
);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
e.find((t) => t.getAttribute("data-type") === "day"),
|
|
20
|
-
String(i.day)
|
|
21
|
-
), await n.type(
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
-
e.find((t) => t.getAttribute("data-type") === "month"),
|
|
24
|
-
String(i.month)
|
|
25
|
-
), await n.type(
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
-
e.find((t) => t.getAttribute("data-type") === "year"),
|
|
28
|
-
String(i.year)
|
|
42
|
+
return new o(
|
|
43
|
+
a("year"),
|
|
44
|
+
a("month"),
|
|
45
|
+
a("day")
|
|
29
46
|
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
33
50
|
export {
|
|
34
|
-
|
|
51
|
+
c as getTestingUtilsDatePicker
|
|
35
52
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.8",
|
|
4
4
|
"module": "./dist/esm/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@hookform/devtools": "4.4.0",
|
|
43
43
|
"@hookform/resolvers": "5.2.1",
|
|
44
44
|
"@internationalized/date": "3.11.0",
|
|
45
|
-
"@payfit/unity-illustrations": "2.12.
|
|
45
|
+
"@payfit/unity-illustrations": "2.12.8",
|
|
46
46
|
"@radix-ui/react-avatar": "1.1.11",
|
|
47
47
|
"@radix-ui/react-slot": "1.2.4",
|
|
48
48
|
"@react-aria/interactions": "3.27.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@hookform/devtools": "^4",
|
|
77
|
-
"@payfit/unity-icons": "2.12.
|
|
78
|
-
"@payfit/unity-themes": "2.12.
|
|
77
|
+
"@payfit/unity-icons": "2.12.8",
|
|
78
|
+
"@payfit/unity-themes": "2.12.8",
|
|
79
79
|
"@storybook/react-vite": "^10.2.2",
|
|
80
80
|
"@tanstack/react-query": "^5",
|
|
81
81
|
"@tanstack/react-router": "^1.131",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
|
|
95
95
|
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
96
96
|
"@payfit/storybook-config": "0.0.0-use.local",
|
|
97
|
-
"@payfit/unity-icons": "2.12.
|
|
98
|
-
"@payfit/unity-illustrations": "2.12.
|
|
99
|
-
"@payfit/unity-themes": "2.12.
|
|
97
|
+
"@payfit/unity-icons": "2.12.8",
|
|
98
|
+
"@payfit/unity-illustrations": "2.12.8",
|
|
99
|
+
"@payfit/unity-themes": "2.12.8",
|
|
100
100
|
"@payfit/vite-configs": "0.0.0-use.local",
|
|
101
101
|
"@storybook/addon-a11y": "10.2.13",
|
|
102
102
|
"@storybook/addon-docs": "10.2.13",
|