@centreon/ui 24.5.1 → 24.5.2
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 +3 -7
- package/public/mockServiceWorker.js +100 -81
- package/src/ActionsList/index.stories.tsx +1 -7
- package/src/Dashboard/Dashboard.styles.ts +2 -3
- package/src/Dashboard/Item.tsx +2 -11
- package/src/Dashboard/Layout.tsx +2 -4
- package/src/Graph/Tree/DescendantNodes.tsx +0 -1
- package/src/Graph/Tree/Links.tsx +2 -15
- package/src/Graph/Tree/Tree.cypress.spec.tsx +0 -24
- package/src/Graph/Tree/Tree.stories.tsx +1 -17
- package/src/Graph/Tree/models.ts +0 -3
- package/src/TopCounterElements/TopCounterLayout.tsx +4 -3
- package/src/TopCounterElements/useCloseOnLegacyPage.tsx +6 -9
- package/src/api/QueryProvider.tsx +1 -1
- package/src/api/useFetchQuery/index.test.ts +5 -0
- package/src/api/useFetchQuery/index.ts +5 -2
- package/src/api/useGraphQuery/index.ts +1 -7
- package/src/api/useMutationQuery/index.ts +5 -2
- package/src/api/useRequest/index.test.ts +3 -0
- package/src/api/useRequest/index.ts +6 -3
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +13 -27
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +19 -0
- package/src/components/Form/AccessRights/AccessRights.styles.ts +1 -1
- package/src/components/Form/AccessRights/AccessRights.tsx +5 -6
- package/src/components/Form/AccessRights/Actions/Actions.styles.ts +7 -3
- package/src/components/Form/AccessRights/Actions/Actions.tsx +32 -15
- package/src/components/Form/AccessRights/Actions/useActions.ts +37 -4
- package/src/components/Form/AccessRights/models.ts +3 -0
- package/src/components/Form/AccessRights/storiesData.ts +3 -0
- package/src/components/List/Item/ListItem.styles.ts +2 -2
- package/src/components/Zoom/Minimap.tsx +2 -4
- package/src/components/Zoom/Zoom.cypress.spec.tsx +13 -13
- package/src/components/Zoom/Zoom.tsx +1 -4
- package/src/components/Zoom/ZoomContent.tsx +2 -5
- package/src/components/index.ts +0 -1
- package/src/index.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/usePluralizedTranslation.ts +3 -20
- package/src/api/logger.ts +0 -11
- package/src/components/Form/AccessRights/useAccessRightsChange.ts +0 -30
- package/src/components/Form/AccessRights/utils.ts +0 -18
- package/src/components/Tabs/Tab.styles.ts +0 -25
- package/src/components/Tabs/TabPanel.tsx +0 -22
- package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -70
- package/src/components/Tabs/Tabs.stories.tsx +0 -55
- package/src/components/Tabs/Tabs.tsx +0 -55
- package/src/components/Tabs/index.ts +0 -6
- package/src/utils/resourcesStatusURL.ts +0 -166
- package/src/utils/usePluralizedTranslation.test.ts +0 -159
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { act, renderHook } from '@testing-library/react';
|
|
2
|
-
import { useAtom } from 'jotai';
|
|
3
|
-
|
|
4
|
-
import { ListingVariant, userAtom } from '@centreon/ui-context';
|
|
5
|
-
|
|
6
|
-
import { usePluralizedTranslation } from './usePluralizedTranslation';
|
|
7
|
-
|
|
8
|
-
const baseUser = {
|
|
9
|
-
alias: 'admin',
|
|
10
|
-
isExportButtonEnabled: false,
|
|
11
|
-
name: 'admin',
|
|
12
|
-
timezone: 'Europe/Paris',
|
|
13
|
-
use_deprecated_pages: false,
|
|
14
|
-
user_interface_density: ListingVariant.compact
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('usePluralizedTranslation', () => {
|
|
18
|
-
describe('English', () => {
|
|
19
|
-
it('returns the plural of a word when the corresponding count is set', () => {
|
|
20
|
-
const { result } = renderHook(() => {
|
|
21
|
-
return {
|
|
22
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
23
|
-
userAtom: useAtom(userAtom)
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
act(() => {
|
|
28
|
-
result.current.userAtom[1]({
|
|
29
|
-
...baseUser,
|
|
30
|
-
locale: 'en'
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
expect(
|
|
35
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
36
|
-
count: 2,
|
|
37
|
-
label: 'House'
|
|
38
|
-
})
|
|
39
|
-
).toEqual('Houses');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('returns the singular of a word when the corresponding count is set', () => {
|
|
43
|
-
const { result } = renderHook(() => {
|
|
44
|
-
return {
|
|
45
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
46
|
-
userAtom: useAtom(userAtom)
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
act(() => {
|
|
51
|
-
result.current.userAtom[1]({
|
|
52
|
-
...baseUser,
|
|
53
|
-
locale: 'en'
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
expect(
|
|
58
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
59
|
-
count: 1,
|
|
60
|
-
label: 'House'
|
|
61
|
-
})
|
|
62
|
-
).toEqual('House');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('returns the plural of a word when the corresponding count is 0 and the language is english', () => {
|
|
66
|
-
const { result } = renderHook(() => {
|
|
67
|
-
return {
|
|
68
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
69
|
-
userAtom: useAtom(userAtom)
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
act(() => {
|
|
74
|
-
result.current.userAtom[1]({
|
|
75
|
-
...baseUser,
|
|
76
|
-
locale: 'en'
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
expect(
|
|
81
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
82
|
-
count: 0,
|
|
83
|
-
label: 'House'
|
|
84
|
-
})
|
|
85
|
-
).toEqual('Houses');
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('French', () => {
|
|
90
|
-
it('returns the plural of a word when the corresponding count is set', () => {
|
|
91
|
-
const { result } = renderHook(() => {
|
|
92
|
-
return {
|
|
93
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
94
|
-
userAtom: useAtom(userAtom)
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
act(() => {
|
|
99
|
-
result.current.userAtom[1]({
|
|
100
|
-
...baseUser,
|
|
101
|
-
locale: 'fr'
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
expect(
|
|
106
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
107
|
-
count: 2,
|
|
108
|
-
label: 'Maison'
|
|
109
|
-
})
|
|
110
|
-
).toEqual('Maisons');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('returns the singular of a word when the corresponding count is set', () => {
|
|
114
|
-
const { result } = renderHook(() => {
|
|
115
|
-
return {
|
|
116
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
117
|
-
userAtom: useAtom(userAtom)
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
act(() => {
|
|
122
|
-
result.current.userAtom[1]({
|
|
123
|
-
...baseUser,
|
|
124
|
-
locale: 'fr'
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
expect(
|
|
129
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
130
|
-
count: 1,
|
|
131
|
-
label: 'Maison'
|
|
132
|
-
})
|
|
133
|
-
).toEqual('Maison');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('returns the singular of a word when the corresponding count is 0 and the language is english', () => {
|
|
137
|
-
const { result } = renderHook(() => {
|
|
138
|
-
return {
|
|
139
|
-
pluralizedTranslation: usePluralizedTranslation(),
|
|
140
|
-
userAtom: useAtom(userAtom)
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
act(() => {
|
|
145
|
-
result.current.userAtom[1]({
|
|
146
|
-
...baseUser,
|
|
147
|
-
locale: 'fr'
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
expect(
|
|
152
|
-
result.current.pluralizedTranslation.pluralizedT({
|
|
153
|
-
count: 0,
|
|
154
|
-
label: 'Maison'
|
|
155
|
-
})
|
|
156
|
-
).toEqual('Maison');
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|