orc-shared 5.10.0-dev.2 → 5.10.0-dev.21
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/metadata.js +30 -11
- package/dist/actions/requestsApi.js +10 -1
- package/dist/components/AppFrame/About.js +136 -100
- package/dist/components/AppFrame/Anchor.js +45 -21
- package/dist/components/AppFrame/AppFrame.js +53 -31
- package/dist/components/AppFrame/Help.js +35 -15
- package/dist/components/AppFrame/MenuItem.js +148 -114
- package/dist/components/AppFrame/Preferences.js +136 -97
- package/dist/components/AppFrame/Sidebar.js +51 -28
- package/dist/components/AppFrame/Topbar.js +61 -36
- package/dist/components/ColumnWrapper.js +28 -5
- package/dist/components/Culture.js +33 -14
- package/dist/components/DropMenu/Menu.js +79 -45
- package/dist/components/DropMenu/index.js +34 -29
- package/dist/components/Form/Combination.js +45 -16
- package/dist/components/Form/Field.js +57 -38
- package/dist/components/Form/FieldElements.js +0 -11
- package/dist/components/Form/Fieldset.js +47 -19
- package/dist/components/Form/Form.js +22 -9
- package/dist/components/Form/FormElement.js +40 -7
- package/dist/components/Form/Inputs/Button.js +63 -18
- package/dist/components/Form/Inputs/ReadOnly.js +50 -27
- package/dist/components/{AppFrame/ApplicationSelector/Header.js → Form/Inputs/Selector.js} +30 -31
- package/dist/components/Form/Inputs/Text.js +20 -37
- package/dist/components/Form/Inputs/Toggles.js +39 -40
- package/dist/components/Form/Inputs/index.js +2 -13
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +31 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +89 -0
- package/dist/components/MaterialUI/DataDisplay/Table.js +109 -18
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +5 -1
- package/dist/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +198 -0
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +4 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +14 -14
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/dist/components/MaterialUI/Inputs/Select.js +2 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/dist/components/MaterialUI/Inputs/Switch.js +17 -1
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -21
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -1
- package/dist/components/MaterialUI/muiThemes.js +2 -1
- package/dist/components/Provision.js +1 -1
- package/dist/constants.js +2 -1
- package/dist/content/iconsSheet.svg +740 -116
- package/dist/hocs/withScrollBox.js +27 -12
- package/dist/hooks/useDaysAndMonthsLocalization.js +77 -0
- package/dist/hooks/useInMemoryPaging.js +135 -0
- package/dist/hooks/useMultipleFieldEditState.js +12 -3
- package/dist/reducers/metadata.js +6 -0
- package/dist/schemas/metadata.js +9 -1
- package/dist/selectors/locale.js +1 -0
- package/dist/selectors/metadata.js +14 -11
- package/dist/sharedMessages.js +184 -0
- package/dist/utils/ListHelper.js +271 -0
- package/dist/utils/comparisonHelper.js +185 -0
- package/dist/utils/propertyBagHelper.js +3 -1
- package/dist/utils/timezoneHelper.js +18 -31
- package/package.json +4 -3
- package/src/actions/metadata.js +11 -0
- package/src/actions/metadata.test.js +27 -0
- package/src/actions/requestsApi.js +6 -0
- package/src/components/AppFrame/About.js +97 -117
- package/src/components/AppFrame/About.test.js +128 -90
- package/src/components/AppFrame/Anchor.js +34 -36
- package/src/components/AppFrame/Anchor.test.js +5 -68
- package/src/components/AppFrame/AppFrame.js +31 -40
- package/src/components/AppFrame/AppFrame.test.js +424 -445
- package/src/components/AppFrame/Help.js +23 -20
- package/src/components/AppFrame/Help.test.js +3 -3
- package/src/components/AppFrame/MenuItem.js +106 -126
- package/src/components/AppFrame/MenuItem.test.js +78 -169
- package/src/components/AppFrame/Preferences.js +110 -98
- package/src/components/AppFrame/Preferences.test.js +115 -219
- package/src/components/AppFrame/Sidebar.js +39 -41
- package/src/components/AppFrame/Sidebar.test.js +88 -168
- package/src/components/AppFrame/Topbar.js +59 -52
- package/src/components/AppFrame/Topbar.test.js +31 -39
- package/src/components/ColumnWrapper.js +18 -9
- package/src/components/Culture.js +20 -10
- package/src/components/Culture.test.js +27 -16
- package/src/components/DropMenu/DropMenu.test.js +185 -224
- package/src/components/DropMenu/Menu.js +73 -80
- package/src/components/DropMenu/Menu.test.js +35 -86
- package/src/components/DropMenu/index.js +19 -15
- package/src/components/Form/Combination.js +35 -28
- package/src/components/Form/Combination.test.js +6 -19
- package/src/components/Form/Field.js +53 -66
- package/src/components/Form/Field.test.js +29 -51
- package/src/components/Form/FieldElements.js +0 -14
- package/src/components/Form/FieldElements.test.js +104 -111
- package/src/components/Form/Fieldset.js +42 -37
- package/src/components/Form/Fieldset.test.js +14 -7
- package/src/components/Form/Form.js +11 -7
- package/src/components/Form/Form.test.js +75 -56
- package/src/components/Form/FormElement.js +24 -16
- package/src/components/Form/InputField.test.js +24 -30
- package/src/components/Form/Inputs/Button.js +58 -14
- package/src/components/Form/Inputs/Button.test.js +32 -7
- package/src/components/Form/Inputs/Inputs.test.js +0 -7
- package/src/components/Form/Inputs/ReadOnly.js +34 -28
- package/src/components/Form/Inputs/ReadOnly.test.js +45 -7
- package/src/components/Form/Inputs/Selector.js +22 -0
- package/src/components/Form/Inputs/Selector.test.js +105 -0
- package/src/components/Form/Inputs/Text.js +15 -44
- package/src/components/Form/Inputs/Text.test.js +20 -29
- package/src/components/Form/Inputs/Toggles.js +27 -26
- package/src/components/Form/Inputs/Toggles.test.js +22 -28
- package/src/components/Form/Inputs/index.js +4 -15
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +1 -4
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +32 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.test.js +3 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +39 -0
- package/src/components/MaterialUI/DataDisplay/Table.js +190 -114
- package/src/components/MaterialUI/DataDisplay/Table.test.js +246 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +4 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +145 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.test.js +457 -0
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +5 -1
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.test.js +7 -1
- package/src/components/MaterialUI/Inputs/DatePicker.js +19 -20
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +11 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/src/components/MaterialUI/Inputs/Select.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/Switch.js +22 -1
- package/src/components/MaterialUI/Inputs/Switch.test.js +23 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/TimePicker.js +10 -19
- package/src/components/MaterialUI/Inputs/TimePicker.test.js +278 -117
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +4 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +27 -0
- package/src/components/MaterialUI/muiThemes.js +1 -0
- package/src/components/Navigation/Bar.test.js +92 -87
- package/src/components/Provision.js +1 -1
- package/src/components/TaskDetailsModal.test.js +1 -3
- package/src/constants.js +1 -0
- package/src/content/iconsSheet.svg +740 -116
- package/src/hocs/withScrollBox.js +32 -19
- package/src/hocs/withScrollBox.test.js +15 -3
- package/src/hooks/useDaysAndMonthsLocalization.js +79 -0
- package/src/hooks/useDaysAndMonthsLocalization.test.js +107 -0
- package/src/hooks/useInMemoryPaging.js +78 -0
- package/src/hooks/useInMemoryPaging.test.js +515 -0
- package/src/hooks/useMultipleFieldEditState.js +11 -4
- package/src/hooks/useMultipleFieldEditState.test.js +49 -1
- package/src/reducers/metadata.js +6 -1
- package/src/reducers/metadata.test.js +31 -0
- package/src/requests +1 -0
- package/src/schemas/metadata.js +3 -0
- package/src/selectors/locale.js +1 -1
- package/src/selectors/metadata.js +12 -9
- package/src/selectors/metadata.test.js +92 -11
- package/src/sharedMessages.js +184 -0
- package/src/timezones.json +883 -0
- package/src/translations/en-US.json +46 -0
- package/src/translations/fr-CA.json +46 -0
- package/src/utils/ListHelper.js +203 -0
- package/src/utils/ListHelper.test.js +710 -0
- package/src/utils/comparisonHelper.js +135 -0
- package/src/utils/comparisonHelper.test.js +334 -0
- package/src/utils/propertyBagHelper.js +2 -0
- package/src/utils/propertyBagHelper.test.js +6 -0
- package/src/utils/timezoneHelper.js +10 -135
- package/src/utils/timezoneHelper.test.js +7 -7
- package/dist/components/Form/FieldList.js +0 -270
- package/dist/components/Form/Inputs/FieldButtons.js +0 -66
- package/dist/components/Form/Inputs/Number.js +0 -117
- package/dist/components/Form/Inputs/SmallButton.js +0 -91
- package/dist/components/Form/Inputs/Time.js +0 -86
- package/dist/components/Form/Inputs/Translation.js +0 -169
- package/src/components/AppFrame/ApplicationSelector/Header.js +0 -34
- package/src/components/AppFrame/ApplicationSelector/Header.test.js +0 -23
- package/src/components/Form/FieldList.js +0 -210
- package/src/components/Form/FieldList.test.js +0 -558
- package/src/components/Form/Inputs/FieldButtons.js +0 -90
- package/src/components/Form/Inputs/Number.js +0 -60
- package/src/components/Form/Inputs/Number.test.js +0 -435
- package/src/components/Form/Inputs/SmallButton.js +0 -37
- package/src/components/Form/Inputs/SmallButton.test.js +0 -65
- package/src/components/Form/Inputs/Time.js +0 -32
- package/src/components/Form/Inputs/Time.test.js +0 -41
- package/src/components/Form/Inputs/Translation.js +0 -93
- package/src/components/Form/Inputs/Translation.test.js +0 -204
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { MemoryRouter } from "react-router-dom";
|
|
3
2
|
import Immutable from "immutable";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import Sidebar, { Bar, EnhancedMenuItem, MenuToggle, Logo } from "./Sidebar";
|
|
3
|
+
import { TestWrapper } from "../../utils/testUtils";
|
|
4
|
+
import Sidebar, { EnhancedMenuItem, MenuToggle, Logo } from "./Sidebar";
|
|
7
5
|
import MenuItem from "./MenuItem";
|
|
8
6
|
|
|
9
7
|
describe("Sidebar", () => {
|
|
@@ -43,106 +41,88 @@ describe("Sidebar", () => {
|
|
|
43
41
|
|
|
44
42
|
it("renders a sidebar with app selector and page menu", () =>
|
|
45
43
|
expect(
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
<TestWrapper
|
|
45
|
+
provider={{ store }}
|
|
46
|
+
stylesProvider
|
|
47
|
+
muiThemeProvider
|
|
48
|
+
memoryRouter={{ initialEntries: ["/Global/second"] }}
|
|
49
|
+
>
|
|
50
|
+
<Sidebar modules={modules} />
|
|
51
|
+
</TestWrapper>,
|
|
53
52
|
"when mounted",
|
|
54
53
|
"to satisfy",
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
<TestWrapper
|
|
55
|
+
provider={{ store }}
|
|
56
|
+
stylesProvider
|
|
57
|
+
muiThemeProvider
|
|
58
|
+
memoryRouter={{ initialEntries: ["/Global/second"] }}
|
|
59
|
+
>
|
|
60
|
+
<div>
|
|
61
|
+
<MenuToggle />
|
|
62
|
+
<EnhancedMenuItem icon="cars" title="First page" id="first" label="First page" />
|
|
63
|
+
<EnhancedMenuItem icon="person" title="Second page" id="second" label="Second page" />
|
|
64
|
+
<Logo />
|
|
65
|
+
</div>
|
|
66
|
+
</TestWrapper>,
|
|
67
67
|
));
|
|
68
68
|
|
|
69
69
|
it("renders a sidebar showing alerts", () =>
|
|
70
70
|
expect(
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
<TestWrapper
|
|
72
|
+
provider={{ store }}
|
|
73
|
+
stylesProvider
|
|
74
|
+
muiThemeProvider
|
|
75
|
+
memoryRouter={{ initialEntries: ["/Global/second"] }}
|
|
76
|
+
>
|
|
77
|
+
<Sidebar modules={modules} activeModules={{ first: { type: "confirm" } }} />
|
|
78
|
+
</TestWrapper>,
|
|
78
79
|
"when mounted",
|
|
79
80
|
"to satisfy",
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<Logo />
|
|
94
|
-
</Bar>
|
|
95
|
-
</MemoryRouter>
|
|
96
|
-
</ThemeProvider>
|
|
97
|
-
</Provider>,
|
|
81
|
+
<TestWrapper
|
|
82
|
+
provider={{ store }}
|
|
83
|
+
stylesProvider
|
|
84
|
+
muiThemeProvider
|
|
85
|
+
memoryRouter={{ initialEntries: ["/Global/second"] }}
|
|
86
|
+
>
|
|
87
|
+
<div>
|
|
88
|
+
<MenuToggle />
|
|
89
|
+
<EnhancedMenuItem icon="cars" title="First page" id="first" label="First page" alert={{ type: "confirm" }} />
|
|
90
|
+
<EnhancedMenuItem icon="person" title="Second page" id="second" label="Second page" />
|
|
91
|
+
<Logo />
|
|
92
|
+
</div>
|
|
93
|
+
</TestWrapper>,
|
|
98
94
|
));
|
|
99
95
|
|
|
100
96
|
it("renders an open sidebar", () =>
|
|
101
97
|
expect(
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
<Sidebar open modules={modules} />
|
|
106
|
-
</MemoryRouter>
|
|
107
|
-
</ThemeProvider>
|
|
108
|
-
</Provider>,
|
|
98
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
99
|
+
<Sidebar open modules={modules} />
|
|
100
|
+
</TestWrapper>,
|
|
109
101
|
"when mounted",
|
|
110
102
|
"to satisfy",
|
|
111
|
-
<
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</Bar>
|
|
120
|
-
</MemoryRouter>
|
|
121
|
-
</ThemeProvider>
|
|
122
|
-
</Provider>,
|
|
103
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
104
|
+
<div>
|
|
105
|
+
<MenuToggle open />
|
|
106
|
+
<EnhancedMenuItem open icon="cars" title="First page" id="first" label="First page" />
|
|
107
|
+
<EnhancedMenuItem open icon="person" title="Second page" id="second" label="Second page" />
|
|
108
|
+
<Logo />
|
|
109
|
+
</div>
|
|
110
|
+
</TestWrapper>,
|
|
123
111
|
));
|
|
124
112
|
|
|
125
113
|
it("renders a minimal sidebar", () =>
|
|
126
114
|
expect(
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
<Sidebar />
|
|
131
|
-
</MemoryRouter>
|
|
132
|
-
</ThemeProvider>
|
|
133
|
-
</Provider>,
|
|
115
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
116
|
+
<Sidebar />
|
|
117
|
+
</TestWrapper>,
|
|
134
118
|
"when mounted",
|
|
135
119
|
"to satisfy",
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
</Bar>
|
|
143
|
-
</MemoryRouter>
|
|
144
|
-
</ThemeProvider>
|
|
145
|
-
</Provider>,
|
|
120
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
121
|
+
<div>
|
|
122
|
+
<MenuToggle />
|
|
123
|
+
<Logo />
|
|
124
|
+
</div>
|
|
125
|
+
</TestWrapper>,
|
|
146
126
|
));
|
|
147
127
|
});
|
|
148
128
|
|
|
@@ -178,34 +158,26 @@ describe("EnhancedMenuItem", () => {
|
|
|
178
158
|
|
|
179
159
|
it("renders a MenuItem with href", () =>
|
|
180
160
|
expect(
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
</MemoryRouter>
|
|
185
|
-
</Provider>,
|
|
161
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
162
|
+
<EnhancedMenuItem id="route" path="/Global/somewhere" />
|
|
163
|
+
</TestWrapper>,
|
|
186
164
|
"when mounted",
|
|
187
165
|
"to satisfy",
|
|
188
|
-
<
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
</MemoryRouter>
|
|
192
|
-
</Provider>,
|
|
166
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
167
|
+
<MenuItem href="/Global/route" />
|
|
168
|
+
</TestWrapper>,
|
|
193
169
|
));
|
|
194
170
|
|
|
195
171
|
it("sets the active flag if path matches href", () =>
|
|
196
172
|
expect(
|
|
197
|
-
<
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
</MemoryRouter>
|
|
201
|
-
</Provider>,
|
|
173
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
174
|
+
<EnhancedMenuItem id="route" />
|
|
175
|
+
</TestWrapper>,
|
|
202
176
|
"when mounted",
|
|
203
177
|
"to satisfy",
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
</MemoryRouter>
|
|
208
|
-
</Provider>,
|
|
178
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
179
|
+
<MenuItem active href="/Global/route" />
|
|
180
|
+
</TestWrapper>,
|
|
209
181
|
));
|
|
210
182
|
});
|
|
211
183
|
|
|
@@ -223,78 +195,26 @@ describe("MenuToggle", () => {
|
|
|
223
195
|
describe("with no theme", () => {
|
|
224
196
|
it("renders a MenuItem with specific settings", () =>
|
|
225
197
|
expect(
|
|
226
|
-
<
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
<MenuToggle toggle={toggle} />
|
|
230
|
-
</MemoryRouter>
|
|
231
|
-
</ThemeProvider>
|
|
232
|
-
</Provider>,
|
|
198
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
199
|
+
<MenuToggle toggle={toggle} />
|
|
200
|
+
</TestWrapper>,
|
|
233
201
|
"when mounted",
|
|
234
202
|
"to satisfy",
|
|
235
|
-
<
|
|
236
|
-
<MenuItem id="sidebarMenuToggle" menuToggle icon="
|
|
237
|
-
</
|
|
203
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
204
|
+
<MenuItem id="sidebarMenuToggle" menuToggle icon="expand" onClick={expect.it("to be a function")} />
|
|
205
|
+
</TestWrapper>,
|
|
238
206
|
));
|
|
239
207
|
|
|
240
208
|
it("renders as open", () =>
|
|
241
209
|
expect(
|
|
242
|
-
<
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
<MenuToggle toggle={toggle} open />
|
|
246
|
-
</MemoryRouter>
|
|
247
|
-
</ThemeProvider>
|
|
248
|
-
</Provider>,
|
|
210
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
211
|
+
<MenuToggle toggle={toggle} open />
|
|
212
|
+
</TestWrapper>,
|
|
249
213
|
"when mounted",
|
|
250
214
|
"to satisfy",
|
|
251
|
-
<
|
|
252
|
-
<MenuItem id="sidebarMenuToggle" menuToggle open icon="
|
|
253
|
-
</
|
|
254
|
-
));
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
describe("with theme values", () => {
|
|
258
|
-
let theme;
|
|
259
|
-
beforeEach(() => {
|
|
260
|
-
theme = {
|
|
261
|
-
icons: {
|
|
262
|
-
sidebarOpen: "open",
|
|
263
|
-
sidebarClosed: "closed",
|
|
264
|
-
},
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
it("renders a MenuItem with specific settings", () =>
|
|
269
|
-
expect(
|
|
270
|
-
<Provider store={store}>
|
|
271
|
-
<ThemeProvider theme={theme}>
|
|
272
|
-
<MemoryRouter>
|
|
273
|
-
<MenuToggle toggle={toggle} />
|
|
274
|
-
</MemoryRouter>
|
|
275
|
-
</ThemeProvider>
|
|
276
|
-
</Provider>,
|
|
277
|
-
"when mounted",
|
|
278
|
-
"to satisfy",
|
|
279
|
-
<Provider store={store}>
|
|
280
|
-
<MenuItem menuToggle icon="closed" onClick={expect.it("to be a function")} />
|
|
281
|
-
</Provider>,
|
|
282
|
-
));
|
|
283
|
-
|
|
284
|
-
it("renders as open", () =>
|
|
285
|
-
expect(
|
|
286
|
-
<Provider store={store}>
|
|
287
|
-
<ThemeProvider theme={theme}>
|
|
288
|
-
<MemoryRouter>
|
|
289
|
-
<MenuToggle toggle={toggle} open />
|
|
290
|
-
</MemoryRouter>
|
|
291
|
-
</ThemeProvider>
|
|
292
|
-
</Provider>,
|
|
293
|
-
"when mounted",
|
|
294
|
-
"to satisfy",
|
|
295
|
-
<Provider store={store}>
|
|
296
|
-
<MenuItem menuToggle open icon="open" onClick={expect.it("to be a function")} />
|
|
297
|
-
</Provider>,
|
|
215
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider memoryRouter>
|
|
216
|
+
<MenuItem id="sidebarMenuToggle" menuToggle open icon="collapse" onClick={expect.it("to be a function")} />
|
|
217
|
+
</TestWrapper>,
|
|
298
218
|
));
|
|
299
219
|
});
|
|
300
220
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { useDispatch, useSelector } from "react-redux";
|
|
4
3
|
import { useIntl } from "react-intl";
|
|
5
|
-
import {
|
|
4
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
6
5
|
import { selectCurrentUsername } from "../../selectors/authentication";
|
|
7
6
|
import { setStateField } from "../../actions/view";
|
|
8
7
|
import { signOut } from "../../actions/authentication";
|
|
@@ -14,12 +13,36 @@ import Anchor from "./Anchor";
|
|
|
14
13
|
import Help from "./Help";
|
|
15
14
|
import sharedMessages from "./../../sharedMessages";
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const useStyles = makeStyles(theme => ({
|
|
17
|
+
wrapper: {
|
|
18
|
+
height: "40px",
|
|
19
|
+
color: theme.palette.text.hint,
|
|
20
|
+
display: "flex",
|
|
21
|
+
justifyContent: "space-between",
|
|
22
|
+
},
|
|
23
|
+
appBox: {
|
|
24
|
+
height: "100%",
|
|
25
|
+
display: "flex",
|
|
26
|
+
flex: 1,
|
|
27
|
+
alignItems: "stretch",
|
|
28
|
+
},
|
|
29
|
+
appLabel: {
|
|
30
|
+
backgroundColor: "#000000",
|
|
31
|
+
color: theme.palette.primary.light,
|
|
32
|
+
fontFamily: theme.typography.button.fontFamily,
|
|
33
|
+
fontSize: "14px",
|
|
34
|
+
textTransform: "uppercase",
|
|
35
|
+
paddingRight: "20px",
|
|
36
|
+
paddingLeft: "6px",
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
},
|
|
40
|
+
appLogo: {
|
|
41
|
+
height: "30px",
|
|
42
|
+
marginRight: "10px",
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
|
|
23
46
|
export const useMenuProps = () => {
|
|
24
47
|
const intl = useIntl();
|
|
25
48
|
const dispatch = useDispatch();
|
|
@@ -58,52 +81,36 @@ export const Menu = () => {
|
|
|
58
81
|
);
|
|
59
82
|
};
|
|
60
83
|
|
|
61
|
-
export const
|
|
62
|
-
|
|
63
|
-
display: flex;
|
|
64
|
-
flex: 1;
|
|
65
|
-
align-items: stretch;
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
export const AppLabel = styled.div`
|
|
69
|
-
background-color: #000000;
|
|
70
|
-
color: ${getThemeProp(["colors", "application", "primary"], "#ffffff")};
|
|
71
|
-
font-family: ${getThemeProp(["fonts", "header"], "sans-serif")};
|
|
72
|
-
font-size: 14px;
|
|
73
|
-
text-transform: uppercase;
|
|
74
|
-
padding-right: 20px;
|
|
75
|
-
padding-left: 6px;
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
export const AppLogo = styled.img.attrs(() => ({ alt: "" }))`
|
|
81
|
-
height: 30px;
|
|
82
|
-
margin-right: 10px;
|
|
83
|
-
`;
|
|
84
|
+
export const CurrentApp = ({ displayName, iconUri }) => {
|
|
85
|
+
const classes = useStyles();
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
);
|
|
87
|
+
return (
|
|
88
|
+
<div className={classes.appLabel}>
|
|
89
|
+
<img src={iconUri} className={classes.appLogo} />
|
|
90
|
+
{displayName}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
91
94
|
CurrentApp.displayName = "CurrentApp";
|
|
92
95
|
|
|
93
|
-
const Topbar = ({ applications, applicationId, currentApplication, onClick, helpUrl, ...config }) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
const Topbar = ({ applications, applicationId, currentApplication, onClick, helpUrl, ...config }) => {
|
|
97
|
+
const classes = useStyles();
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div onClick={onClick} className={classes.wrapper} data-test-id="wrapper">
|
|
101
|
+
<div className={classes.appBox}>
|
|
102
|
+
<ApplicationSelector
|
|
103
|
+
{...{
|
|
104
|
+
applications,
|
|
105
|
+
applicationId,
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
<CurrentApp {...(currentApplication || {})} />
|
|
109
|
+
</div>
|
|
110
|
+
<Menu {...config} />
|
|
111
|
+
<Help {...{ helpUrl }} />
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
108
115
|
|
|
109
116
|
export default Topbar;
|
|
@@ -10,9 +10,7 @@ import { SIGN_OUT_REQUEST, SIGN_OUT_SUCCESS, SIGN_OUT_FAILURE } from "../../acti
|
|
|
10
10
|
import { PREFS_NAME } from "./Preferences";
|
|
11
11
|
import { ABOUT_NAME } from "./About";
|
|
12
12
|
import ApplicationSelector from "./ApplicationSelector";
|
|
13
|
-
import {
|
|
14
|
-
import Topbar, { Wrapper, AppBox, CurrentApp, AppLabel, AppLogo, useMenuProps } from "./Topbar";
|
|
15
|
-
import { HelpLink } from "./Help";
|
|
13
|
+
import Topbar, { CurrentApp, useMenuProps } from "./Topbar";
|
|
16
14
|
|
|
17
15
|
jest.mock("../../utils/buildUrl", () => {
|
|
18
16
|
const modExport = {};
|
|
@@ -77,19 +75,17 @@ describe("Topbar", () => {
|
|
|
77
75
|
</Provider>,
|
|
78
76
|
"when mounted",
|
|
79
77
|
"to satisfy",
|
|
80
|
-
<
|
|
81
|
-
<
|
|
78
|
+
<div onClick={clicker}>
|
|
79
|
+
<div>
|
|
82
80
|
<ApplicationSelector {...props} />
|
|
83
|
-
<
|
|
84
|
-
<
|
|
81
|
+
<div>
|
|
82
|
+
<img src="/test/url" />
|
|
85
83
|
Test label
|
|
86
|
-
</
|
|
87
|
-
</
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<HelpLink>Help</HelpLink>
|
|
92
|
-
</Wrapper>,
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<Ignore />
|
|
87
|
+
<a>Help</a>
|
|
88
|
+
</div>,
|
|
93
89
|
));
|
|
94
90
|
|
|
95
91
|
it("doesn't break if no current app", () =>
|
|
@@ -101,18 +97,16 @@ describe("Topbar", () => {
|
|
|
101
97
|
</Provider>,
|
|
102
98
|
"when mounted",
|
|
103
99
|
"to satisfy",
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
<Ignore />
|
|
107
|
-
<AppLabel>
|
|
108
|
-
<AppLogo />
|
|
109
|
-
</AppLabel>
|
|
110
|
-
</AppBox>
|
|
111
|
-
<MenuWrapper>
|
|
100
|
+
<div onClick={clicker}>
|
|
101
|
+
<div>
|
|
112
102
|
<Ignore />
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
<div>
|
|
104
|
+
<img />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<Ignore />
|
|
108
|
+
<a>Help</a>
|
|
109
|
+
</div>,
|
|
116
110
|
));
|
|
117
111
|
|
|
118
112
|
it("doesn't break if no apps at all", () =>
|
|
@@ -124,18 +118,16 @@ describe("Topbar", () => {
|
|
|
124
118
|
</Provider>,
|
|
125
119
|
"when mounted",
|
|
126
120
|
"to satisfy",
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
<Ignore />
|
|
130
|
-
<AppLabel>
|
|
131
|
-
<AppLogo />
|
|
132
|
-
</AppLabel>
|
|
133
|
-
</AppBox>
|
|
134
|
-
<MenuWrapper>
|
|
121
|
+
<div onClick={clicker}>
|
|
122
|
+
<div>
|
|
135
123
|
<Ignore />
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
<div>
|
|
125
|
+
<img />
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<Ignore />
|
|
129
|
+
<a>Help</a>
|
|
130
|
+
</div>,
|
|
139
131
|
));
|
|
140
132
|
});
|
|
141
133
|
|
|
@@ -246,9 +238,9 @@ describe("CurrentApp", () => {
|
|
|
246
238
|
<CurrentApp displayName="Test label" iconUri="/test/url" />,
|
|
247
239
|
"when mounted",
|
|
248
240
|
"to satisfy",
|
|
249
|
-
<
|
|
250
|
-
<
|
|
241
|
+
<div>
|
|
242
|
+
<img src="/test/url" />
|
|
251
243
|
Test label
|
|
252
|
-
</
|
|
244
|
+
</div>,
|
|
253
245
|
));
|
|
254
246
|
});
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
3
|
+
|
|
4
|
+
const useStyles = makeStyles(() => ({
|
|
5
|
+
columnWrapper: {
|
|
6
|
+
flex: "0 1 100%",
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
minHeight: 0,
|
|
10
|
+
minWidth: 0,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const ColumnWrapper = ({ children }) => {
|
|
15
|
+
const classes = useStyles();
|
|
16
|
+
|
|
17
|
+
return <div className={classes.columnWrapper}>{children}</div>;
|
|
18
|
+
};
|
|
10
19
|
|
|
11
20
|
export default ColumnWrapper;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { useSelector } from "react-redux";
|
|
4
|
-
import { currentLocaleOrDefault } from "../selectors/locale";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
5
3
|
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
|
6
4
|
import * as date_fns_locale from "date-fns/locale";
|
|
7
5
|
import { findCorrespondingLocale } from "../utils/localizationHelper";
|
|
6
|
+
import useDaysAndMonthsLocalization from "../hooks/useDaysAndMonthsLocalization";
|
|
7
|
+
|
|
8
|
+
export let customFnsLocale = null;
|
|
8
9
|
|
|
9
10
|
const Culture = () => {
|
|
10
|
-
const locale =
|
|
11
|
-
const
|
|
11
|
+
const { locale } = useIntl();
|
|
12
|
+
const daysAndMonthsLocalization = useDaysAndMonthsLocalization();
|
|
12
13
|
|
|
13
14
|
useMemo(() => {
|
|
14
|
-
const fnsLocale = findCorrespondingLocale(date_fns_locale,
|
|
15
|
+
const fnsLocale = findCorrespondingLocale(date_fns_locale, locale);
|
|
15
16
|
|
|
16
17
|
if (fnsLocale != null) {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
customFnsLocale = {
|
|
19
|
+
...fnsLocale,
|
|
20
|
+
localize: {
|
|
21
|
+
...fnsLocale.localize,
|
|
22
|
+
day: n => daysAndMonthsLocalization.weekdaysMin[n],
|
|
23
|
+
month: n => daysAndMonthsLocalization.months[n],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
registerLocale(locale, customFnsLocale);
|
|
28
|
+
setDefaultLocale(locale);
|
|
19
29
|
}
|
|
20
|
-
}, [
|
|
30
|
+
}, [locale, daysAndMonthsLocalization]);
|
|
21
31
|
|
|
22
32
|
return <React.Fragment />;
|
|
23
33
|
};
|