orc-shared 1.7.0-dev.8 → 5.2.0-dev.1
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/dist/actions/modules.js +15 -1
- package/dist/actions/navigation.js +1 -14
- package/dist/actions/scopes.js +2 -3
- package/dist/buildStore.js +1 -7
- package/dist/components/AppFrame/Sidebar.js +8 -4
- package/dist/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +6 -18
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -4
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +7 -7
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/dist/components/MaterialUI/Inputs/DatePicker.js +8 -15
- package/dist/components/MaterialUI/Inputs/InputBase.js +16 -102
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -7
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +46 -43
- package/dist/components/MaterialUI/Inputs/TimePicker.js +2 -5
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +1 -3
- package/dist/components/Routing/Page.js +1 -4
- package/dist/components/Routing/SegmentPage.js +1 -4
- package/dist/components/Routing/SubPage.js +8 -38
- package/dist/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/dist/constants.js +2 -18
- package/dist/content/icons/hide.svg +1 -10
- package/dist/content/icons/open-in-new-tab.svg +1 -3
- package/dist/content/iconsSheet.svg +650 -117
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/hooks/useEditState.js +2 -4
- package/dist/reducers/modules.js +3 -4
- package/dist/reducers/navigation.js +0 -16
- package/dist/reducers/request.js +1 -6
- package/dist/reducers/scopes.js +0 -3
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/authentication.js +1 -15
- package/dist/selectors/metadata.js +1 -1
- package/dist/sharedMessages.js +1 -17
- package/dist/utils/propertyHelper.js +0 -33
- package/dist/utils/timezoneHelper.js +1 -23
- package/package.json +7 -10
- package/src/actions/modules.js +10 -0
- package/src/actions/modules.test.js +14 -0
- package/src/actions/navigation.js +0 -7
- package/src/actions/navigation.test.js +0 -12
- package/src/actions/scopes.js +1 -2
- package/src/actions/scopes.test.js +1 -2
- package/src/buildStore.js +0 -6
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +3 -4
- package/src/components/Form/InputField.test.js +0 -18
- package/src/components/Form/Inputs/Date.test.js +0 -18
- package/src/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/src/components/MaterialUI/DataDisplay/Notification.test.js +0 -37
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +5 -23
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +0 -121
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -20
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -2
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +8 -8
- package/src/components/MaterialUI/DataDisplay/tableHelpers.test.js +0 -93
- package/src/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/src/components/MaterialUI/Inputs/Autocomplete.test.js +0 -15
- package/src/components/MaterialUI/Inputs/DatePicker.js +3 -17
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +1 -143
- package/src/components/MaterialUI/Inputs/InputBase.js +15 -103
- package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -376
- package/src/components/MaterialUI/Inputs/InputBaseProps.js +0 -6
- package/src/components/MaterialUI/Inputs/InputBaseProps.test.js +0 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +27 -39
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +34 -39
- package/src/components/MaterialUI/Inputs/TimePicker.js +1 -5
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +1 -2
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +0 -52
- package/src/components/Routing/Page.js +1 -12
- package/src/components/Routing/SegmentPage.js +1 -12
- package/src/components/Routing/SubPage.js +9 -41
- package/src/components/Routing/SubPage.test.js +1 -295
- package/src/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/src/components/Scope/useScopeConfirmationModalState.test.js +35 -4
- package/src/components/Text.test.js +59 -44
- package/src/constants.js +0 -15
- package/src/content/icons/hide.svg +1 -10
- package/src/content/icons/open-in-new-tab.svg +1 -3
- package/src/content/iconsSheet.svg +650 -117
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +2 -12
- package/src/hooks/useEditState.test.js +1 -1
- package/src/hooks/useLabelMessage.test.js +10 -16
- package/src/reducers/modules.js +4 -4
- package/src/reducers/modules.test.js +5 -5
- package/src/reducers/navigation.js +0 -24
- package/src/reducers/navigation.test.js +0 -38
- package/src/reducers/request.js +1 -6
- package/src/reducers/request.test.js +0 -34
- package/src/reducers/scopes.js +0 -3
- package/src/reducers/scopes.test.js +0 -47
- package/src/reducers/view.js +1 -1
- package/src/reducers/view.test.js +8 -1
- package/src/selectors/authentication.js +0 -13
- package/src/selectors/authentication.test.js +0 -322
- package/src/selectors/metadata.js +1 -1
- package/src/selectors/metadata.test.js +0 -12
- package/src/sharedMessages.js +1 -17
- package/src/translations/en-US.json +12 -16
- package/src/translations/fr-CA.json +12 -16
- package/src/utils/propertyHelper.js +0 -38
- package/src/utils/propertyHelper.test.js +0 -160
- package/src/utils/timezoneHelper.js +0 -18
- package/src/utils/timezoneHelper.test.js +1 -23
- package/dist/actions/globalErrorMessages.js +0 -63
- package/dist/actions/tasks.js +0 -170
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -160
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -88
- package/dist/components/TaskDetailsModal.js +0 -191
- package/dist/content/icons/anonymize.svg +0 -3
- package/dist/content/icons/archives.svg +0 -3
- package/dist/content/icons/clean-index.svg +0 -3
- package/dist/content/icons/date-index.svg +0 -3
- package/dist/content/icons/inventory.svg +0 -4
- package/dist/content/icons/query-tester.svg +0 -10
- package/dist/content/icons/reciprocity.svg +0 -10
- package/dist/content/icons/schema.svg +0 -11
- package/dist/content/icons/synonyms.svg +0 -3
- package/dist/content/icons/tenant.svg +0 -3
- package/dist/content/icons/time-index.svg +0 -3
- package/dist/hooks/useDispatchWithErrorHandling.js +0 -103
- package/dist/hooks/useScopeGuardLoader.js +0 -77
- package/dist/reducers/globalErrorMessages.js +0 -78
- package/dist/reducers/scopeRouteState.js +0 -83
- package/dist/reducers/tasks.js +0 -98
- package/dist/selectors/globalErrorMessages.js +0 -57
- package/dist/selectors/scopeRouteState.js +0 -53
- package/dist/selectors/tasks.js +0 -64
- package/dist/utils/responseProcessingHelper.js +0 -86
- package/src/actions/globalErrorMessages.js +0 -12
- package/src/actions/globalErrorMessages.test.js +0 -21
- package/src/actions/tasks.js +0 -77
- package/src/actions/tasks.test.js +0 -169
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -108
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.test.js +0 -468
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -29
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.test.js +0 -147
- package/src/components/TaskDetailsModal.js +0 -132
- package/src/components/TaskDetailsModal.test.js +0 -317
- package/src/content/icons/anonymize.svg +0 -3
- package/src/content/icons/archives.svg +0 -3
- package/src/content/icons/clean-index.svg +0 -3
- package/src/content/icons/date-index.svg +0 -3
- package/src/content/icons/inventory.svg +0 -4
- package/src/content/icons/query-tester.svg +0 -10
- package/src/content/icons/reciprocity.svg +0 -10
- package/src/content/icons/schema.svg +0 -11
- package/src/content/icons/synonyms.svg +0 -3
- package/src/content/icons/tenant.svg +0 -3
- package/src/content/icons/time-index.svg +0 -3
- package/src/hooks/useDispatchWithErrorHandling.js +0 -57
- package/src/hooks/useDispatchWithErrorHandling.test.js +0 -230
- package/src/hooks/useScopeGuardLoader.js +0 -25
- package/src/hooks/useScopeGuardLoader.test.js +0 -187
- package/src/reducers/globalErrorMessages.js +0 -25
- package/src/reducers/globalErrorMessages.test.js +0 -66
- package/src/reducers/scopeRouteState.js +0 -29
- package/src/reducers/scopeRouteState.test.js +0 -49
- package/src/reducers/tasks.js +0 -56
- package/src/reducers/tasks.test.js +0 -404
- package/src/selectors/globalErrorMessages.js +0 -11
- package/src/selectors/globalErrorMessages.test.js +0 -25
- package/src/selectors/scopeRouteState.js +0 -5
- package/src/selectors/scopeRouteState.test.js +0 -13
- package/src/selectors/tasks.js +0 -16
- package/src/selectors/tasks.test.js +0 -60
- package/src/utils/responseProcessingHelper.js +0 -42
- package/src/utils/responseProcessingHelper.test.js +0 -218
package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.test.js
DELETED
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import GlobalErrorMessagesModal, { GlobalErrorMessageLabel } from "./GlobalErrorMessages";
|
|
3
|
-
import { createMuiTheme, extractMessages, TestWrapper } from "../../../../utils/testUtils";
|
|
4
|
-
import Immutable from "immutable";
|
|
5
|
-
import ActionModal from "./ActionModal";
|
|
6
|
-
import sharedMessages from "../../../../sharedMessages";
|
|
7
|
-
import Grid from "@material-ui/core/Grid";
|
|
8
|
-
import ListItemText from "@material-ui/core/ListItemText";
|
|
9
|
-
import List from "@material-ui/core/List";
|
|
10
|
-
import ListItem from "@material-ui/core/ListItem";
|
|
11
|
-
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
|
12
|
-
import { popGlobalErrorMessage } from "../../../../actions/globalErrorMessages";
|
|
13
|
-
import sinon from "sinon";
|
|
14
|
-
import { render } from "@testing-library/react";
|
|
15
|
-
import { getByText, fireEvent } from "@testing-library/react";
|
|
16
|
-
|
|
17
|
-
const theme = createMuiTheme();
|
|
18
|
-
const messages = extractMessages(sharedMessages);
|
|
19
|
-
|
|
20
|
-
const metadataPayload = {
|
|
21
|
-
metadata: {
|
|
22
|
-
lookups: {
|
|
23
|
-
order: {
|
|
24
|
-
index: {
|
|
25
|
-
OrderStatus: {
|
|
26
|
-
lookupName: "OrderStatus",
|
|
27
|
-
values: {
|
|
28
|
-
Completed: {
|
|
29
|
-
id: "03caa0ebecd04792a96c2f8df5b9b35a",
|
|
30
|
-
value: "Completed",
|
|
31
|
-
lookupId: "OrderStatus",
|
|
32
|
-
displayName: {
|
|
33
|
-
"en-US": "Completed",
|
|
34
|
-
},
|
|
35
|
-
sortOrder: 0,
|
|
36
|
-
isActive: true,
|
|
37
|
-
isSystem: true,
|
|
38
|
-
},
|
|
39
|
-
InProgress: {
|
|
40
|
-
id: "13caa0ebecd04792a96c2f8df5b9b35a",
|
|
41
|
-
value: "InProgress",
|
|
42
|
-
lookupId: "InProgress",
|
|
43
|
-
displayName: {
|
|
44
|
-
"en-US": "In Progress",
|
|
45
|
-
},
|
|
46
|
-
sortOrder: 1,
|
|
47
|
-
isActive: false,
|
|
48
|
-
isSystem: true,
|
|
49
|
-
},
|
|
50
|
-
MessageWithArguments: {
|
|
51
|
-
id: "23caa0ebecd04792a96c2f8df5b9b35a",
|
|
52
|
-
value: "MessageWithArguments",
|
|
53
|
-
lookupId: "MessageWithArguments",
|
|
54
|
-
displayName: {
|
|
55
|
-
"en-US": "This is the message with arguments {customKey1} {customKey2}",
|
|
56
|
-
},
|
|
57
|
-
sortOrder: 1,
|
|
58
|
-
isActive: false,
|
|
59
|
-
isSystem: true,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
displayName: {
|
|
63
|
-
"en-US": "Order Status",
|
|
64
|
-
},
|
|
65
|
-
isActive: true,
|
|
66
|
-
isSystem: true,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
list: [],
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
describe("GlobalErrorMessagesModal", () => {
|
|
76
|
-
let store, state, dispatch;
|
|
77
|
-
beforeEach(() => {
|
|
78
|
-
state = Immutable.fromJS({
|
|
79
|
-
locale: {
|
|
80
|
-
locale: "en",
|
|
81
|
-
supportedLocales: ["en", "fr"],
|
|
82
|
-
},
|
|
83
|
-
globalErrorMessages: {
|
|
84
|
-
dialog: {
|
|
85
|
-
errorMessages: [],
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
...metadataPayload,
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
dispatch = sinon.spy().named("dispatch");
|
|
92
|
-
|
|
93
|
-
store = {
|
|
94
|
-
subscribe: () => {},
|
|
95
|
-
getState: () => state,
|
|
96
|
-
dispatch: dispatch,
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const errorMessages = [
|
|
101
|
-
{
|
|
102
|
-
title: "ze title",
|
|
103
|
-
description: "desc",
|
|
104
|
-
messages: [
|
|
105
|
-
{ message: "error msg" },
|
|
106
|
-
{ lookupModule: "order", lookupName: "OrderStatus", lookupKey: "InProgress" },
|
|
107
|
-
{
|
|
108
|
-
lookupModule: "order",
|
|
109
|
-
lookupName: "OrderStatus",
|
|
110
|
-
lookupKey: "MessageWithArguments",
|
|
111
|
-
lookupReplacementValues: { customKey1: "val1", customKey2: "val2" },
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
];
|
|
116
|
-
const expectedMessagesContent = (
|
|
117
|
-
<Grid item xs={12}>
|
|
118
|
-
<List>
|
|
119
|
-
<ListItem key={0}>
|
|
120
|
-
<ListItemIcon>●</ListItemIcon>
|
|
121
|
-
<ListItemText>
|
|
122
|
-
<GlobalErrorMessageLabel>error msg</GlobalErrorMessageLabel>
|
|
123
|
-
</ListItemText>
|
|
124
|
-
</ListItem>
|
|
125
|
-
<ListItem key={1}>
|
|
126
|
-
<ListItemIcon>●</ListItemIcon>
|
|
127
|
-
<ListItemText>
|
|
128
|
-
<GlobalErrorMessageLabel>In Progress</GlobalErrorMessageLabel>
|
|
129
|
-
</ListItemText>
|
|
130
|
-
</ListItem>
|
|
131
|
-
<ListItem key={2}>
|
|
132
|
-
<ListItemIcon>●</ListItemIcon>
|
|
133
|
-
<ListItemText>
|
|
134
|
-
<GlobalErrorMessageLabel>This is the message with arguments val1 val2</GlobalErrorMessageLabel>
|
|
135
|
-
</ListItemText>
|
|
136
|
-
</ListItem>
|
|
137
|
-
</List>
|
|
138
|
-
</Grid>
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
it("Renders no dialog because state contains no messages", () => {
|
|
142
|
-
const component = (
|
|
143
|
-
<TestWrapper
|
|
144
|
-
provider={{ store }}
|
|
145
|
-
intlProvider={{ messages }}
|
|
146
|
-
memoryRouter
|
|
147
|
-
stylesProvider
|
|
148
|
-
muiThemeProvider={{ theme }}
|
|
149
|
-
>
|
|
150
|
-
<GlobalErrorMessagesModal>
|
|
151
|
-
<div>children</div>
|
|
152
|
-
</GlobalErrorMessagesModal>
|
|
153
|
-
</TestWrapper>
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
const expected = (
|
|
157
|
-
<TestWrapper
|
|
158
|
-
provider={{ store }}
|
|
159
|
-
intlProvider={{ messages }}
|
|
160
|
-
memoryRouter
|
|
161
|
-
stylesProvider
|
|
162
|
-
muiThemeProvider={{ theme }}
|
|
163
|
-
>
|
|
164
|
-
<div>children</div>
|
|
165
|
-
</TestWrapper>
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("Renders dialog with messages", () => {
|
|
172
|
-
state = state.setIn(["globalErrorMessages", "dialog", "errorMessages"], Immutable.fromJS(errorMessages));
|
|
173
|
-
|
|
174
|
-
const component = (
|
|
175
|
-
<TestWrapper
|
|
176
|
-
provider={{ store }}
|
|
177
|
-
intlProvider={{ messages }}
|
|
178
|
-
memoryRouter
|
|
179
|
-
stylesProvider
|
|
180
|
-
muiThemeProvider={{ theme }}
|
|
181
|
-
>
|
|
182
|
-
<div>
|
|
183
|
-
<GlobalErrorMessagesModal>
|
|
184
|
-
<div>children</div>
|
|
185
|
-
</GlobalErrorMessagesModal>
|
|
186
|
-
</div>
|
|
187
|
-
</TestWrapper>
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
const content = (
|
|
191
|
-
<Grid container spacing={2}>
|
|
192
|
-
<Grid container item spacing={0}>
|
|
193
|
-
<Grid item xs={12}>
|
|
194
|
-
desc
|
|
195
|
-
</Grid>
|
|
196
|
-
{expectedMessagesContent}
|
|
197
|
-
</Grid>
|
|
198
|
-
</Grid>
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
const expected = (
|
|
202
|
-
<TestWrapper
|
|
203
|
-
provider={{ store }}
|
|
204
|
-
intlProvider={{ messages }}
|
|
205
|
-
memoryRouter
|
|
206
|
-
stylesProvider
|
|
207
|
-
muiThemeProvider={{ theme }}
|
|
208
|
-
>
|
|
209
|
-
<div>
|
|
210
|
-
<div>children</div>
|
|
211
|
-
<ActionModal
|
|
212
|
-
title={"ze title"}
|
|
213
|
-
message={content}
|
|
214
|
-
open={true}
|
|
215
|
-
actions={[{ label: sharedMessages.close, isPrimary: true }]}
|
|
216
|
-
/>
|
|
217
|
-
</div>
|
|
218
|
-
</TestWrapper>
|
|
219
|
-
);
|
|
220
|
-
|
|
221
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it("Renders dialog with messages with default title", () => {
|
|
225
|
-
state = state.setIn(
|
|
226
|
-
["globalErrorMessages", "dialog", "errorMessages"],
|
|
227
|
-
Immutable.fromJS([{ ...errorMessages[0], title: null }]),
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
const component = (
|
|
231
|
-
<TestWrapper
|
|
232
|
-
provider={{ store }}
|
|
233
|
-
intlProvider={{ messages }}
|
|
234
|
-
memoryRouter
|
|
235
|
-
stylesProvider
|
|
236
|
-
muiThemeProvider={{ theme }}
|
|
237
|
-
>
|
|
238
|
-
<div>
|
|
239
|
-
<GlobalErrorMessagesModal>
|
|
240
|
-
<div>children</div>
|
|
241
|
-
</GlobalErrorMessagesModal>
|
|
242
|
-
</div>
|
|
243
|
-
</TestWrapper>
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
const content = (
|
|
247
|
-
<Grid container spacing={2}>
|
|
248
|
-
<Grid container item spacing={0}>
|
|
249
|
-
<Grid item xs={12}>
|
|
250
|
-
desc
|
|
251
|
-
</Grid>
|
|
252
|
-
{expectedMessagesContent}
|
|
253
|
-
</Grid>
|
|
254
|
-
</Grid>
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
const expected = (
|
|
258
|
-
<TestWrapper
|
|
259
|
-
provider={{ store }}
|
|
260
|
-
intlProvider={{ messages }}
|
|
261
|
-
memoryRouter
|
|
262
|
-
stylesProvider
|
|
263
|
-
muiThemeProvider={{ theme }}
|
|
264
|
-
>
|
|
265
|
-
<div>
|
|
266
|
-
<div>children</div>
|
|
267
|
-
<ActionModal
|
|
268
|
-
title={"Error"}
|
|
269
|
-
message={content}
|
|
270
|
-
open={true}
|
|
271
|
-
actions={[{ label: sharedMessages.close, isPrimary: true }]}
|
|
272
|
-
/>
|
|
273
|
-
</div>
|
|
274
|
-
</TestWrapper>
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it("Renders dialog with messages without description", () => {
|
|
281
|
-
state = state.setIn(
|
|
282
|
-
["globalErrorMessages", "dialog", "errorMessages"],
|
|
283
|
-
Immutable.fromJS([{ ...errorMessages[0], description: null }]),
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
const component = (
|
|
287
|
-
<TestWrapper
|
|
288
|
-
provider={{ store }}
|
|
289
|
-
intlProvider={{ messages }}
|
|
290
|
-
memoryRouter
|
|
291
|
-
stylesProvider
|
|
292
|
-
muiThemeProvider={{ theme }}
|
|
293
|
-
>
|
|
294
|
-
<div>
|
|
295
|
-
<GlobalErrorMessagesModal>
|
|
296
|
-
<div>children</div>
|
|
297
|
-
</GlobalErrorMessagesModal>
|
|
298
|
-
</div>
|
|
299
|
-
</TestWrapper>
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
const content = (
|
|
303
|
-
<Grid container spacing={2}>
|
|
304
|
-
<Grid container item spacing={0}>
|
|
305
|
-
{expectedMessagesContent}
|
|
306
|
-
</Grid>
|
|
307
|
-
</Grid>
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const expected = (
|
|
311
|
-
<TestWrapper
|
|
312
|
-
provider={{ store }}
|
|
313
|
-
intlProvider={{ messages }}
|
|
314
|
-
memoryRouter
|
|
315
|
-
stylesProvider
|
|
316
|
-
muiThemeProvider={{ theme }}
|
|
317
|
-
>
|
|
318
|
-
<div>
|
|
319
|
-
<div>children</div>
|
|
320
|
-
<ActionModal
|
|
321
|
-
title={"ze title"}
|
|
322
|
-
message={content}
|
|
323
|
-
open={true}
|
|
324
|
-
actions={[{ label: sharedMessages.close, isPrimary: true }]}
|
|
325
|
-
/>
|
|
326
|
-
</div>
|
|
327
|
-
</TestWrapper>
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
it("Renders dialog without messages (empty)", () => {
|
|
334
|
-
state = state.setIn(
|
|
335
|
-
["globalErrorMessages", "dialog", "errorMessages"],
|
|
336
|
-
Immutable.fromJS([{ ...errorMessages[0], messages: [] }]),
|
|
337
|
-
);
|
|
338
|
-
|
|
339
|
-
const component = (
|
|
340
|
-
<TestWrapper
|
|
341
|
-
provider={{ store }}
|
|
342
|
-
intlProvider={{ messages }}
|
|
343
|
-
memoryRouter
|
|
344
|
-
stylesProvider
|
|
345
|
-
muiThemeProvider={{ theme }}
|
|
346
|
-
>
|
|
347
|
-
<div>
|
|
348
|
-
<GlobalErrorMessagesModal>
|
|
349
|
-
<div>children</div>
|
|
350
|
-
</GlobalErrorMessagesModal>
|
|
351
|
-
</div>
|
|
352
|
-
</TestWrapper>
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
const content = (
|
|
356
|
-
<Grid container spacing={2}>
|
|
357
|
-
<Grid container item spacing={0}>
|
|
358
|
-
<Grid item xs={12}>
|
|
359
|
-
desc
|
|
360
|
-
</Grid>
|
|
361
|
-
</Grid>
|
|
362
|
-
</Grid>
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
const expected = (
|
|
366
|
-
<TestWrapper
|
|
367
|
-
provider={{ store }}
|
|
368
|
-
intlProvider={{ messages }}
|
|
369
|
-
memoryRouter
|
|
370
|
-
stylesProvider
|
|
371
|
-
muiThemeProvider={{ theme }}
|
|
372
|
-
>
|
|
373
|
-
<div>
|
|
374
|
-
<div>children</div>
|
|
375
|
-
<ActionModal
|
|
376
|
-
title={"ze title"}
|
|
377
|
-
message={content}
|
|
378
|
-
open={true}
|
|
379
|
-
actions={[{ label: sharedMessages.close, isPrimary: true }]}
|
|
380
|
-
/>
|
|
381
|
-
</div>
|
|
382
|
-
</TestWrapper>
|
|
383
|
-
);
|
|
384
|
-
|
|
385
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it("Renders dialog without messages (null)", () => {
|
|
389
|
-
state = state.setIn(
|
|
390
|
-
["globalErrorMessages", "dialog", "errorMessages"],
|
|
391
|
-
Immutable.fromJS([{ ...errorMessages[0], messages: null }]),
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
const component = (
|
|
395
|
-
<TestWrapper
|
|
396
|
-
provider={{ store }}
|
|
397
|
-
intlProvider={{ messages }}
|
|
398
|
-
memoryRouter
|
|
399
|
-
stylesProvider
|
|
400
|
-
muiThemeProvider={{ theme }}
|
|
401
|
-
>
|
|
402
|
-
<div>
|
|
403
|
-
<GlobalErrorMessagesModal>
|
|
404
|
-
<div>children</div>
|
|
405
|
-
</GlobalErrorMessagesModal>
|
|
406
|
-
</div>
|
|
407
|
-
</TestWrapper>
|
|
408
|
-
);
|
|
409
|
-
|
|
410
|
-
const content = (
|
|
411
|
-
<Grid container spacing={2}>
|
|
412
|
-
<Grid container item spacing={0}>
|
|
413
|
-
<Grid item xs={12}>
|
|
414
|
-
desc
|
|
415
|
-
</Grid>
|
|
416
|
-
</Grid>
|
|
417
|
-
</Grid>
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
const expected = (
|
|
421
|
-
<TestWrapper
|
|
422
|
-
provider={{ store }}
|
|
423
|
-
intlProvider={{ messages }}
|
|
424
|
-
memoryRouter
|
|
425
|
-
stylesProvider
|
|
426
|
-
muiThemeProvider={{ theme }}
|
|
427
|
-
>
|
|
428
|
-
<div>
|
|
429
|
-
<div>children</div>
|
|
430
|
-
<ActionModal
|
|
431
|
-
title={"ze title"}
|
|
432
|
-
message={content}
|
|
433
|
-
open={true}
|
|
434
|
-
actions={[{ label: sharedMessages.close, isPrimary: true }]}
|
|
435
|
-
/>
|
|
436
|
-
</div>
|
|
437
|
-
</TestWrapper>
|
|
438
|
-
);
|
|
439
|
-
|
|
440
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
it("The close button pop the message", () => {
|
|
444
|
-
state = state.setIn(["globalErrorMessages", "dialog", "errorMessages"], Immutable.fromJS(errorMessages));
|
|
445
|
-
|
|
446
|
-
const component = (
|
|
447
|
-
<TestWrapper
|
|
448
|
-
provider={{ store }}
|
|
449
|
-
intlProvider={{ messages }}
|
|
450
|
-
memoryRouter
|
|
451
|
-
stylesProvider
|
|
452
|
-
muiThemeProvider={{ theme }}
|
|
453
|
-
>
|
|
454
|
-
<div>
|
|
455
|
-
<GlobalErrorMessagesModal>
|
|
456
|
-
<div>children</div>
|
|
457
|
-
</GlobalErrorMessagesModal>
|
|
458
|
-
</div>
|
|
459
|
-
</TestWrapper>
|
|
460
|
-
);
|
|
461
|
-
|
|
462
|
-
const { container } = render(component);
|
|
463
|
-
const button = getByText(container, "Close");
|
|
464
|
-
fireEvent.click(button);
|
|
465
|
-
|
|
466
|
-
expect(dispatch, "to have calls satisfying", [{ args: [popGlobalErrorMessage()] }]);
|
|
467
|
-
});
|
|
468
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import TooltippedTypography from "../TooltippedElements/TooltippedTypography";
|
|
3
|
-
import { namedLookupLocalizedSelector } from "../../../../selectors/metadata";
|
|
4
|
-
import { useSelector } from "react-redux";
|
|
5
|
-
|
|
6
|
-
const LookupDisplayValue = ({
|
|
7
|
-
moduleName,
|
|
8
|
-
lookupName,
|
|
9
|
-
lookupKey,
|
|
10
|
-
lookupReplacementValues,
|
|
11
|
-
labelComponent,
|
|
12
|
-
...otherProps
|
|
13
|
-
}) => {
|
|
14
|
-
let value = useSelector(namedLookupLocalizedSelector(moduleName, lookupName, lookupKey));
|
|
15
|
-
|
|
16
|
-
if (value && lookupReplacementValues) {
|
|
17
|
-
Object.keys(lookupReplacementValues).forEach(key => {
|
|
18
|
-
value = value.replace("{" + key + "}", lookupReplacementValues[key]);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const DisplayComponent =
|
|
23
|
-
labelComponent ??
|
|
24
|
-
(({ children }) => <TooltippedTypography noWrap {...otherProps} children={children} titleValue={value} />);
|
|
25
|
-
|
|
26
|
-
return <DisplayComponent>{value}</DisplayComponent>;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default LookupDisplayValue;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import LookupDisplayValue from "./LookupDisplayValue";
|
|
3
|
-
import { createMuiTheme, TestWrapper } from "../../../../utils/testUtils";
|
|
4
|
-
import Immutable from "immutable";
|
|
5
|
-
import TooltippedTypography from "../TooltippedElements/TooltippedTypography";
|
|
6
|
-
|
|
7
|
-
const theme = createMuiTheme();
|
|
8
|
-
|
|
9
|
-
const metadataPayload = {
|
|
10
|
-
metadata: {
|
|
11
|
-
lookups: {
|
|
12
|
-
order: {
|
|
13
|
-
index: {
|
|
14
|
-
OrderStatus: {
|
|
15
|
-
lookupName: "OrderStatus",
|
|
16
|
-
values: {
|
|
17
|
-
Completed: {
|
|
18
|
-
id: "03caa0ebecd04792a96c2f8df5b9b35a",
|
|
19
|
-
value: "Completed",
|
|
20
|
-
lookupId: "OrderStatus",
|
|
21
|
-
displayName: {
|
|
22
|
-
"en-US": "Completed",
|
|
23
|
-
},
|
|
24
|
-
sortOrder: 0,
|
|
25
|
-
isActive: true,
|
|
26
|
-
isSystem: true,
|
|
27
|
-
},
|
|
28
|
-
InProgress: {
|
|
29
|
-
id: "13caa0ebecd04792a96c2f8df5b9b35a",
|
|
30
|
-
value: "InProgress",
|
|
31
|
-
lookupId: "InProgress",
|
|
32
|
-
displayName: {
|
|
33
|
-
"en-US": "In Progress",
|
|
34
|
-
},
|
|
35
|
-
sortOrder: 1,
|
|
36
|
-
isActive: false,
|
|
37
|
-
isSystem: true,
|
|
38
|
-
},
|
|
39
|
-
MessageWithArguments: {
|
|
40
|
-
id: "23caa0ebecd04792a96c2f8df5b9b35a",
|
|
41
|
-
value: "MessageWithArguments",
|
|
42
|
-
lookupId: "MessageWithArguments",
|
|
43
|
-
displayName: {
|
|
44
|
-
"en-US": "This is the message with arguments {customKey1} {customKey2}",
|
|
45
|
-
},
|
|
46
|
-
sortOrder: 1,
|
|
47
|
-
isActive: false,
|
|
48
|
-
isSystem: true,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
displayName: {
|
|
52
|
-
"en-US": "Order Status",
|
|
53
|
-
},
|
|
54
|
-
isActive: true,
|
|
55
|
-
isSystem: true,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
list: [],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
describe("LookupDisplayValue", () => {
|
|
65
|
-
let store, state;
|
|
66
|
-
beforeEach(() => {
|
|
67
|
-
state = Immutable.fromJS({
|
|
68
|
-
locale: {
|
|
69
|
-
locale: "en",
|
|
70
|
-
supportedLocales: ["en", "fr"],
|
|
71
|
-
},
|
|
72
|
-
...metadataPayload,
|
|
73
|
-
});
|
|
74
|
-
store = {
|
|
75
|
-
subscribe: () => {},
|
|
76
|
-
getState: () => state,
|
|
77
|
-
dispatch: () => {},
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("Renders lookup value", () => {
|
|
82
|
-
const component = (
|
|
83
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
84
|
-
<LookupDisplayValue moduleName="order" lookupName="OrderStatus" lookupKey="InProgress" />
|
|
85
|
-
</TestWrapper>
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const expected = (
|
|
89
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
90
|
-
<TooltippedTypography noWrap children={"In Progress"} titleValue={"In Progress"} />
|
|
91
|
-
</TestWrapper>
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("Renders lookup value with arguments", () => {
|
|
98
|
-
const component = (
|
|
99
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
100
|
-
<LookupDisplayValue
|
|
101
|
-
moduleName="order"
|
|
102
|
-
lookupName="OrderStatus"
|
|
103
|
-
lookupKey="MessageWithArguments"
|
|
104
|
-
lookupReplacementValues={{ customKey1: "val1", customKey2: "val2" }}
|
|
105
|
-
/>
|
|
106
|
-
</TestWrapper>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const expected = (
|
|
110
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
111
|
-
<TooltippedTypography
|
|
112
|
-
noWrap
|
|
113
|
-
children={"This is the message with arguments val1 val2"}
|
|
114
|
-
titleValue={"This is the message with arguments val1 val2"}
|
|
115
|
-
/>
|
|
116
|
-
</TestWrapper>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("Renders lookup value with custom component", () => {
|
|
123
|
-
const CustomComponent = ({ children }) => {
|
|
124
|
-
return <div>{children}</div>;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const component = (
|
|
128
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
129
|
-
<LookupDisplayValue
|
|
130
|
-
moduleName="order"
|
|
131
|
-
lookupName="OrderStatus"
|
|
132
|
-
lookupKey="MessageWithArguments"
|
|
133
|
-
lookupReplacementValues={{ customKey1: "val1", customKey2: "val2" }}
|
|
134
|
-
labelComponent={CustomComponent}
|
|
135
|
-
/>
|
|
136
|
-
</TestWrapper>
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
const expected = (
|
|
140
|
-
<TestWrapper provider={{ store }} memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
141
|
-
<div>This is the message with arguments val1 val2</div>
|
|
142
|
-
</TestWrapper>
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
146
|
-
});
|
|
147
|
-
});
|