orc-shared 5.10.2-dev.4 → 5.99.0-dev.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/dist/components/AppFrame/About.js +13 -13
- package/dist/components/AppFrame/Anchor.js +7 -7
- package/dist/components/AppFrame/AppFrame.js +3 -3
- package/dist/components/AppFrame/Help.js +4 -4
- package/dist/components/AppFrame/MenuItem.js +17 -26
- package/dist/components/AppFrame/Preferences.js +14 -14
- package/dist/components/AppFrame/Sidebar.js +6 -6
- package/dist/components/AppFrame/Topbar.js +6 -6
- package/dist/components/ApplicationModuleLoader.js +3 -2
- package/dist/components/Authenticate.js +29 -22
- package/dist/components/DropMenu/Menu.js +9 -9
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/Form/Field.js +4 -4
- package/dist/components/Form/Inputs/Button.js +2 -2
- package/dist/components/{IconButton.js → Form/Inputs/MultiSelector.js} +33 -31
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/InternetExplorerWarningMessage.js +15 -15
- package/dist/components/LoadingIcon.js +38 -17
- package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +4 -4
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/dist/components/MaterialUI/Inputs/InputBase.js +20 -188
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/Select.js +10 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
- package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
- package/dist/components/MaterialUI/muiThemes.js +2 -0
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +115 -56
- package/dist/components/Scope/ScopeNode.js +62 -57
- package/dist/components/Sidepanel.js +59 -23
- package/dist/components/Spritesheet.js +35 -17
- package/dist/components/Text.js +1 -60
- package/dist/components/ToastList.js +95 -64
- package/dist/components/Treeview/Branch.js +82 -20
- package/dist/components/Treeview/Label.js +108 -31
- package/dist/components/Treeview/Leaf.js +56 -12
- package/dist/components/Treeview/Node.js +22 -9
- package/dist/components/Treeview/index.js +7 -1
- package/dist/components/Treeview/settings.js +17 -6
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
- package/package.json +2 -2
- package/src/components/AppFrame/About.js +13 -13
- package/src/components/AppFrame/Anchor.js +7 -7
- package/src/components/AppFrame/AppFrame.js +3 -3
- package/src/components/AppFrame/Help.js +4 -4
- package/src/components/AppFrame/MenuItem.js +15 -23
- package/src/components/AppFrame/Preferences.js +14 -14
- package/src/components/AppFrame/Sidebar.js +6 -6
- package/src/components/AppFrame/Topbar.js +6 -6
- package/src/components/ApplicationModuleLoader.js +2 -2
- package/src/components/ApplicationModuleLoader.test.js +15 -28
- package/src/components/Authenticate.js +21 -23
- package/src/components/Authenticate.test.js +19 -27
- package/src/components/DropMenu/Menu.js +9 -9
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/Field.js +4 -4
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/Button.js +2 -2
- package/src/components/Form/Inputs/MultiSelector.js +23 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/InternetExplorerWarningMessage.js +15 -15
- package/src/components/Loader.test.js +50 -59
- package/src/components/LoadingIcon.js +27 -14
- package/src/components/LoadingIcon.test.js +11 -15
- package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +3 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -74
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +6 -18
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
- package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
- package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/src/components/MaterialUI/Inputs/InputBase.js +31 -214
- package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -460
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +7 -0
- package/src/components/MaterialUI/Inputs/Select.test.js +45 -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 +1 -1
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
- package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
- package/src/components/MaterialUI/muiThemes.js +3 -0
- package/src/components/Navigation/Navigation.test.js +0 -5
- package/src/components/Navigation/useNavigationState.test.js +79 -222
- package/src/components/Provision.js +36 -42
- package/src/components/Provision.test.js +10 -26
- package/src/components/Routing/SegmentPage.js +68 -52
- package/src/components/Routing/SegmentPage.test.js +4 -12
- package/src/components/Scope/ScopeNode.js +44 -55
- package/src/components/Scope/ScopeNode.test.js +84 -163
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +54 -27
- package/src/components/Spritesheet.js +23 -21
- package/src/components/Spritesheet.test.js +10 -10
- package/src/components/Text.js +0 -49
- package/src/components/ToastList.js +79 -90
- package/src/components/ToastList.test.js +29 -103
- package/src/components/Treeview/Branch.js +65 -47
- package/src/components/Treeview/Branch.test.js +2 -43
- package/src/components/Treeview/Label.js +68 -54
- package/src/components/Treeview/Label.test.js +55 -63
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +1 -15
- package/src/components/Treeview/Node.js +16 -9
- package/src/components/Treeview/Node.test.js +269 -200
- package/src/components/Treeview/Treeview.test.js +248 -248
- package/src/components/Treeview/index.js +6 -0
- package/src/components/Treeview/settings.js +10 -6
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/src/utils/toastHelper.js +8 -0
- package/src/utils/toastHelper.test.js +41 -0
- package/dist/components/Button.js +0 -70
- package/dist/components/CategoryList.js +0 -197
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/Icon.js +0 -69
- package/dist/components/Input.js +0 -101
- package/dist/components/List/DataCell.js +0 -129
- package/dist/components/List/HeadCell.js +0 -125
- package/dist/components/List/HeadRow.js +0 -73
- package/dist/components/List/List.js +0 -274
- package/dist/components/List/Row.js +0 -109
- package/dist/components/List/enhanceColumnDefs.js +0 -111
- package/dist/components/List/index.js +0 -59
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/Modal/index.js +0 -86
- package/dist/components/MultiSelector.js +0 -187
- package/dist/components/Navigation/Bar.js +0 -293
- package/dist/components/Navigation/Tab.js +0 -182
- package/dist/components/Placeholder.js +0 -114
- package/dist/components/Scope/Selector.js +0 -123
- package/dist/components/Selector.js +0 -185
- package/dist/components/Switch.js +0 -128
- package/dist/components/Toolbar.js +0 -227
- package/dist/components/Tooltip.js +0 -66
- package/dist/getTheme.js +0 -158
- package/dist/getThemeOverrides.js +0 -93
- package/dist/hocs/withAuthentication.js +0 -72
- package/dist/utils/styledPropFuncs.js +0 -88
- package/src/components/Button.js +0 -90
- package/src/components/Button.test.js +0 -49
- package/src/components/CategoryList.js +0 -140
- package/src/components/CategoryList.test.js +0 -667
- package/src/components/Checkbox.js +0 -63
- package/src/components/Checkbox.test.js +0 -122
- package/src/components/Icon.js +0 -18
- package/src/components/IconButton.js +0 -30
- package/src/components/IconButton.test.js +0 -61
- package/src/components/Input.js +0 -35
- package/src/components/Input.test.js +0 -34
- package/src/components/List/DataCell.js +0 -77
- package/src/components/List/DataCell.test.js +0 -357
- package/src/components/List/HeadCell.js +0 -105
- package/src/components/List/HeadCell.test.js +0 -331
- package/src/components/List/HeadRow.js +0 -21
- package/src/components/List/HeadRow.test.js +0 -27
- package/src/components/List/List.js +0 -162
- package/src/components/List/List.test.js +0 -705
- package/src/components/List/Row.js +0 -72
- package/src/components/List/Row.test.js +0 -194
- package/src/components/List/enhanceColumnDefs.js +0 -54
- package/src/components/List/enhanceColumnDefs.test.js +0 -179
- package/src/components/List/index.js +0 -6
- package/src/components/Modal/Background.js +0 -10
- package/src/components/Modal/Dialog.js +0 -27
- package/src/components/Modal/Dialog.test.js +0 -20
- package/src/components/Modal/Modal.test.js +0 -52
- package/src/components/Modal/Wrapper.js +0 -32
- package/src/components/Modal/Wrapper.test.js +0 -55
- package/src/components/Modal/index.js +0 -22
- package/src/components/MultiSelector.js +0 -104
- package/src/components/MultiSelector.test.js +0 -348
- package/src/components/Navigation/Bar.js +0 -212
- package/src/components/Navigation/Bar.test.js +0 -552
- package/src/components/Navigation/Tab.js +0 -156
- package/src/components/Navigation/Tab.test.js +0 -404
- package/src/components/Placeholder.js +0 -61
- package/src/components/Placeholder.test.js +0 -106
- package/src/components/Scope/Selector.js +0 -70
- package/src/components/Scope/Selector.test.js +0 -138
- package/src/components/Selector.js +0 -191
- package/src/components/Selector.test.js +0 -157
- package/src/components/Switch.js +0 -112
- package/src/components/Switch.test.js +0 -130
- package/src/components/Text.test.js +0 -132
- package/src/components/Toolbar.js +0 -178
- package/src/components/Toolbar.test.js +0 -478
- package/src/components/Tooltip.js +0 -51
- package/src/components/Tooltip.test.js +0 -21
- package/src/getTheme.js +0 -103
- package/src/getTheme.test.js +0 -92
- package/src/getThemeOverrides.js +0 -27
- package/src/hocs/withAuthentication.js +0 -18
- package/src/hocs/withAuthentication.test.js +0 -120
- package/src/utils/styledPropFuncs.js +0 -20
- package/src/utils/styledPropFuncs.test.js +0 -166
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import
|
|
4
|
-
import Placeholder from "./Placeholder";
|
|
3
|
+
import Placeholder from "./MaterialUI/DataDisplay/PredefinedElements/Placeholder";
|
|
5
4
|
import ErrorPlaceholder from "./ErrorPlaceholder";
|
|
6
5
|
|
|
7
6
|
describe("ErrorPlaceholder", () => {
|
|
@@ -14,9 +13,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
14
13
|
getState: () => ({}),
|
|
15
14
|
}}
|
|
16
15
|
>
|
|
17
|
-
<
|
|
18
|
-
<ErrorPlaceholder message="Error" />
|
|
19
|
-
</ThemeProvider>
|
|
16
|
+
<ErrorPlaceholder message="Error" />
|
|
20
17
|
</Provider>,
|
|
21
18
|
"when mounted",
|
|
22
19
|
"to satisfy",
|
|
@@ -27,7 +24,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
27
24
|
getState: () => ({}),
|
|
28
25
|
}}
|
|
29
26
|
>
|
|
30
|
-
<Placeholder icon="
|
|
27
|
+
<Placeholder icon="report-problem-triangle" error title="Error" />
|
|
31
28
|
</Provider>,
|
|
32
29
|
));
|
|
33
30
|
|
|
@@ -40,9 +37,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
40
37
|
getState: () => ({}),
|
|
41
38
|
}}
|
|
42
39
|
>
|
|
43
|
-
<
|
|
44
|
-
<ErrorPlaceholder message="Error" description="This failed" />
|
|
45
|
-
</ThemeProvider>
|
|
40
|
+
<ErrorPlaceholder message="Error" description="This failed" />
|
|
46
41
|
</Provider>,
|
|
47
42
|
"when mounted",
|
|
48
43
|
"to satisfy",
|
|
@@ -53,7 +48,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
53
48
|
getState: () => ({}),
|
|
54
49
|
}}
|
|
55
50
|
>
|
|
56
|
-
<Placeholder icon="
|
|
51
|
+
<Placeholder icon="report-problem-triangle" error title="Error" subtitle="This failed" />
|
|
57
52
|
</Provider>,
|
|
58
53
|
));
|
|
59
54
|
|
|
@@ -67,9 +62,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
67
62
|
getState: () => ({}),
|
|
68
63
|
}}
|
|
69
64
|
>
|
|
70
|
-
<
|
|
71
|
-
<ErrorPlaceholder message="Error" onClick={handler} />
|
|
72
|
-
</ThemeProvider>
|
|
65
|
+
<ErrorPlaceholder message="Error" onClick={handler} />
|
|
73
66
|
</Provider>,
|
|
74
67
|
"when mounted",
|
|
75
68
|
"to satisfy",
|
|
@@ -80,7 +73,7 @@ describe("ErrorPlaceholder", () => {
|
|
|
80
73
|
getState: () => ({}),
|
|
81
74
|
}}
|
|
82
75
|
>
|
|
83
|
-
<Placeholder icon="
|
|
76
|
+
<Placeholder icon="report-problem-triangle" error title="Error" onClick={handler} />
|
|
84
77
|
</Provider>,
|
|
85
78
|
);
|
|
86
79
|
});
|
|
@@ -7,13 +7,13 @@ const useStyles = makeStyles(theme => ({
|
|
|
7
7
|
flex: "0 1 auto",
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: "column",
|
|
10
|
-
marginTop:
|
|
10
|
+
marginTop: theme.spacing(2),
|
|
11
11
|
position: "relative",
|
|
12
12
|
},
|
|
13
13
|
label: {
|
|
14
|
-
minHeight:
|
|
14
|
+
minHeight: theme.spacing(1.7),
|
|
15
15
|
color: theme.palette.text.hint,
|
|
16
|
-
marginBottom:
|
|
16
|
+
marginBottom: theme.spacing(1),
|
|
17
17
|
},
|
|
18
18
|
invalidLabel: {
|
|
19
19
|
color: theme.palette.error.main,
|
|
@@ -22,7 +22,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
22
22
|
textAlign: "center",
|
|
23
23
|
},
|
|
24
24
|
labelOnly: {
|
|
25
|
-
marginBottom:
|
|
25
|
+
marginBottom: 0,
|
|
26
26
|
},
|
|
27
27
|
requiredLabel: {
|
|
28
28
|
"&::after": {
|
|
@@ -114,10 +114,11 @@ describe("InputField", () => {
|
|
|
114
114
|
if (type === "MultiSelector") {
|
|
115
115
|
val = ["thing"];
|
|
116
116
|
emptyVal = [];
|
|
117
|
+
target = "[role='button']";
|
|
117
118
|
} else {
|
|
118
119
|
val = "thing";
|
|
120
|
+
target = "select";
|
|
119
121
|
}
|
|
120
|
-
target = "select";
|
|
121
122
|
} else if (type === "SwitchInput") {
|
|
122
123
|
val = true;
|
|
123
124
|
} else if (type === "DateInput") {
|
|
@@ -9,10 +9,10 @@ const useStyles = makeStyles(theme => ({
|
|
|
9
9
|
positionedButton: {
|
|
10
10
|
width: "max-content",
|
|
11
11
|
position: "relative",
|
|
12
|
-
padding:
|
|
12
|
+
padding: `${theme.spacing(0.6, 1.4)} !important`,
|
|
13
13
|
"&:hover": {
|
|
14
14
|
borderColor: "#4fa1f0",
|
|
15
|
-
boxShadow:
|
|
15
|
+
boxShadow: `${theme.spacing(0, 0, 0.4)} #4fa1f0`,
|
|
16
16
|
outline: "none",
|
|
17
17
|
backgroundColor: "#f7f7f7 !important",
|
|
18
18
|
},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Select from "../../MaterialUI/Inputs/Select";
|
|
3
|
+
import { memoize } from "../../../utils";
|
|
4
|
+
import SelectProps from "../../MaterialUI/Inputs/SelectProps";
|
|
5
|
+
|
|
6
|
+
export const selectEventUpdater = memoize(update => value => update(value));
|
|
7
|
+
|
|
8
|
+
const MultiSelector = ({ value, options, update, ...props }) => {
|
|
9
|
+
const selectProps = new SelectProps();
|
|
10
|
+
|
|
11
|
+
selectProps.set(SelectProps.propNames.value, value);
|
|
12
|
+
selectProps.set(SelectProps.propNames.onClose, props.onBlur);
|
|
13
|
+
selectProps.set(SelectProps.propNames.disabled, props.disabled);
|
|
14
|
+
selectProps.set(SelectProps.propNames.multiple, true);
|
|
15
|
+
selectProps.set(SelectProps.propNames.update, selectEventUpdater(update));
|
|
16
|
+
|
|
17
|
+
const hasError = props.required && (!Array.isArray(value) || value.length === 0);
|
|
18
|
+
selectProps.set(SelectProps.propNames.error, hasError);
|
|
19
|
+
|
|
20
|
+
return <Select options={options} selectProps={selectProps} />;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default MultiSelector;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import sinon from "sinon";
|
|
3
|
+
import MultiSelector, { selectEventUpdater } from "./MultiSelector";
|
|
4
|
+
import { TestWrapper, createMuiTheme } from "../../../utils/testUtils";
|
|
5
|
+
import Immutable from "immutable";
|
|
6
|
+
import SelectMUI from "@material-ui/core/Select";
|
|
7
|
+
import MenuItem from "@material-ui/core/MenuItem";
|
|
8
|
+
import TooltippedTypography from "../../MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography";
|
|
9
|
+
import Icon from "../../MaterialUI/DataDisplay/Icon";
|
|
10
|
+
|
|
11
|
+
describe("MultiSelector", () => {
|
|
12
|
+
let update, state, store, chevronDown;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
update = sinon.spy().named("update");
|
|
15
|
+
|
|
16
|
+
state = Immutable.fromJS({
|
|
17
|
+
locale: {
|
|
18
|
+
locale: "en-CA",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
store = {
|
|
23
|
+
subscribe: () => {},
|
|
24
|
+
dispatch: () => {},
|
|
25
|
+
getState: () => state,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
chevronDown = props => {
|
|
29
|
+
return <Icon id="dropdown-chevron-down" {...props} />;
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const theme = createMuiTheme();
|
|
34
|
+
|
|
35
|
+
it("renders a multi selector with multiple options", () =>
|
|
36
|
+
expect(
|
|
37
|
+
<TestWrapper provider={{ store }} intlProvider stylesProvider muiThemeProvider={{ theme }}>
|
|
38
|
+
<MultiSelector
|
|
39
|
+
update={update}
|
|
40
|
+
value={["English"]}
|
|
41
|
+
options={[
|
|
42
|
+
{ value: "English", label: "English" },
|
|
43
|
+
{ value: "Francais", label: "Francais" },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
</TestWrapper>,
|
|
47
|
+
"when mounted",
|
|
48
|
+
"to satisfy",
|
|
49
|
+
<TestWrapper provider={{ store }} intlProvider stylesProvider muiThemeProvider={{ theme }}>
|
|
50
|
+
<SelectMUI
|
|
51
|
+
value={["English"]}
|
|
52
|
+
disableUnderline={true}
|
|
53
|
+
IconComponent={chevronDown}
|
|
54
|
+
error={false}
|
|
55
|
+
multiple={true}
|
|
56
|
+
renderValue={selected => selected.join(", ")}
|
|
57
|
+
>
|
|
58
|
+
<MenuItem key="English" value="English">
|
|
59
|
+
<TooltippedTypography children="English" titleValue="English" />
|
|
60
|
+
</MenuItem>
|
|
61
|
+
<MenuItem key="Francais" value="Francais">
|
|
62
|
+
<TooltippedTypography noWrap children="Francais" titleValue="Francais" />
|
|
63
|
+
</MenuItem>
|
|
64
|
+
</SelectMUI>
|
|
65
|
+
</TestWrapper>,
|
|
66
|
+
));
|
|
67
|
+
|
|
68
|
+
it("renders a multi selector with an error", () => {
|
|
69
|
+
expect(
|
|
70
|
+
<TestWrapper provider={{ store }} intlProvider stylesProvider muiThemeProvider={{ theme }}>
|
|
71
|
+
<MultiSelector
|
|
72
|
+
update={update}
|
|
73
|
+
required={true}
|
|
74
|
+
value={[]}
|
|
75
|
+
options={[
|
|
76
|
+
{ value: "English", label: "English" },
|
|
77
|
+
{ value: "Francais", label: "Francais" },
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
</TestWrapper>,
|
|
81
|
+
"when mounted",
|
|
82
|
+
"to satisfy",
|
|
83
|
+
<TestWrapper provider={{ store }} intlProvider stylesProvider muiThemeProvider={{ theme }}>
|
|
84
|
+
<div>
|
|
85
|
+
<SelectMUI value={[""]} disableUnderline={true} IconComponent={chevronDown} error={true} multiple={true}>
|
|
86
|
+
<MenuItem key="English" value="English">
|
|
87
|
+
<TooltippedTypography children="English" titleValue="English" />
|
|
88
|
+
</MenuItem>
|
|
89
|
+
<MenuItem key="Francais" value="Francais">
|
|
90
|
+
<TooltippedTypography noWrap children="Francais" titleValue="Francais" />
|
|
91
|
+
</MenuItem>
|
|
92
|
+
</SelectMUI>
|
|
93
|
+
<div></div>
|
|
94
|
+
</div>
|
|
95
|
+
</TestWrapper>,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("selectEventUpdater", () => {
|
|
101
|
+
let update;
|
|
102
|
+
beforeEach(() => {
|
|
103
|
+
update = sinon.spy().named("update");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("creates a handler for an event and calls update with the value of the target", () =>
|
|
107
|
+
expect(selectEventUpdater, "called with", [update], "called with", ["foo"]).then(() =>
|
|
108
|
+
expect(update, "to have calls satisfying", [{ args: ["foo"] }]),
|
|
109
|
+
));
|
|
110
|
+
|
|
111
|
+
it("is memoized", () => expect(selectEventUpdater, "called with", [update], "to be", selectEventUpdater(update)));
|
|
112
|
+
});
|
|
@@ -8,29 +8,29 @@ import sharedMessages from "../sharedMessages";
|
|
|
8
8
|
const useStyles = makeStyles(theme => ({
|
|
9
9
|
container: {
|
|
10
10
|
fontFamily: "'Open Sans', sans-serif",
|
|
11
|
-
fontSize:
|
|
11
|
+
fontSize: theme.spacing(1.4),
|
|
12
12
|
background: "rgba(255,255,255,0.85)",
|
|
13
|
-
maxWidth:
|
|
14
|
-
width:
|
|
13
|
+
maxWidth: theme.spacing(70),
|
|
14
|
+
width: `calc(100% - ${theme.spacing(4)})`,
|
|
15
15
|
display: "block",
|
|
16
16
|
top: "50%",
|
|
17
17
|
left: "50%",
|
|
18
18
|
position: "absolute",
|
|
19
|
-
boxShadow:
|
|
19
|
+
boxShadow: `${theme.spacing(0, 0.4, 0.8, 0)} rgba(0, 0, 0, 0.2), ${theme.spacing(0, 0.6, 2, 0)} rgba(0, 0, 0, 0.19)`,
|
|
20
20
|
transform: "translateY(-50%) translateX(-50%)",
|
|
21
|
-
padding:
|
|
22
|
-
borderRadius:
|
|
21
|
+
padding: theme.spacing(8),
|
|
22
|
+
borderRadius: theme.spacing(0.3),
|
|
23
23
|
"& header": {
|
|
24
|
-
paddingBottom:
|
|
25
|
-
marginBottom:
|
|
24
|
+
paddingBottom: theme.spacing(2),
|
|
25
|
+
marginBottom: theme.spacing(2),
|
|
26
26
|
borderBottom: "1px solid #999",
|
|
27
27
|
"& h1": {
|
|
28
28
|
fontWeight: 400,
|
|
29
|
-
fontWize:
|
|
29
|
+
fontWize: theme.spacing(3),
|
|
30
30
|
marginTop: 0,
|
|
31
|
-
marginBottom:
|
|
31
|
+
marginBottom: theme.spacing(0.5),
|
|
32
32
|
"& p": {
|
|
33
|
-
fontSize:
|
|
33
|
+
fontSize: theme.spacing(1.6),
|
|
34
34
|
margin: 0,
|
|
35
35
|
color: "#999",
|
|
36
36
|
fontWeight: 400,
|
|
@@ -43,7 +43,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
43
43
|
flexWrap: "wrap",
|
|
44
44
|
width: "100%",
|
|
45
45
|
boxSizing: "border-box",
|
|
46
|
-
marginTop:
|
|
46
|
+
marginTop: theme.spacing(4),
|
|
47
47
|
},
|
|
48
48
|
gridItem: {
|
|
49
49
|
display: "flex",
|
|
@@ -52,16 +52,16 @@ const useStyles = makeStyles(theme => ({
|
|
|
52
52
|
flexDirection: "column",
|
|
53
53
|
},
|
|
54
54
|
browserIconContainer: {
|
|
55
|
-
width:
|
|
55
|
+
width: theme.spacing(4.8),
|
|
56
56
|
textAlign: "center",
|
|
57
57
|
},
|
|
58
58
|
browserIconCaption: {
|
|
59
|
-
fontSize:
|
|
59
|
+
fontSize: theme.spacing(1.1),
|
|
60
60
|
color: "#999",
|
|
61
61
|
},
|
|
62
62
|
browserIcon: {
|
|
63
63
|
stroke: "none",
|
|
64
|
-
fontSize:
|
|
64
|
+
fontSize: theme.spacing(4.8),
|
|
65
65
|
},
|
|
66
66
|
}));
|
|
67
67
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { ThemeProvider } from "styled-components";
|
|
4
3
|
import { mount, act } from "unexpected-reaction";
|
|
5
4
|
import sinon from "sinon";
|
|
6
|
-
import { spyOnConsole } from "../utils/testUtils";
|
|
5
|
+
import { createMuiTheme, spyOnConsole, TestWrapper } from "../utils/testUtils";
|
|
7
6
|
import ErrorPlaceholder from "./ErrorPlaceholder";
|
|
8
7
|
import Loader, { Loading } from "./Loader";
|
|
8
|
+
import ColumnWrapper from "./ColumnWrapper";
|
|
9
|
+
import LoadingIcon from "./LoadingIcon";
|
|
10
|
+
|
|
11
|
+
const theme = createMuiTheme();
|
|
9
12
|
|
|
10
13
|
describe("Loader placeholder", () => {
|
|
11
14
|
let clock;
|
|
@@ -18,11 +21,11 @@ describe("Loader placeholder", () => {
|
|
|
18
21
|
|
|
19
22
|
it("renders null, then load spinner if no props set", () => {
|
|
20
23
|
const loader = mount(
|
|
21
|
-
<
|
|
24
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
22
25
|
<div>
|
|
23
26
|
<Loading />
|
|
24
27
|
</div>
|
|
25
|
-
</
|
|
28
|
+
</TestWrapper>,
|
|
26
29
|
);
|
|
27
30
|
expect(loader, "to satisfy", <div />);
|
|
28
31
|
act(() => {
|
|
@@ -30,12 +33,12 @@ describe("Loader placeholder", () => {
|
|
|
30
33
|
});
|
|
31
34
|
expect(
|
|
32
35
|
loader,
|
|
33
|
-
"queried for first",
|
|
34
|
-
"svg",
|
|
35
36
|
"to satisfy",
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
37
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
38
|
+
<div>
|
|
39
|
+
<LoadingIcon />
|
|
40
|
+
</div>
|
|
41
|
+
</TestWrapper>,
|
|
39
42
|
);
|
|
40
43
|
});
|
|
41
44
|
|
|
@@ -50,9 +53,7 @@ describe("Loader placeholder", () => {
|
|
|
50
53
|
getState: () => ({}),
|
|
51
54
|
}}
|
|
52
55
|
>
|
|
53
|
-
<
|
|
54
|
-
<Loading {...{ error }} />
|
|
55
|
-
</ThemeProvider>
|
|
56
|
+
<Loading {...{ error }} />
|
|
56
57
|
</Provider>,
|
|
57
58
|
"when mounted",
|
|
58
59
|
"to satisfy",
|
|
@@ -63,9 +64,7 @@ describe("Loader placeholder", () => {
|
|
|
63
64
|
getState: () => ({}),
|
|
64
65
|
}}
|
|
65
66
|
>
|
|
66
|
-
<
|
|
67
|
-
<ErrorPlaceholder message="This is a test" />
|
|
68
|
-
</ThemeProvider>
|
|
67
|
+
<ErrorPlaceholder message="This is a test" />
|
|
69
68
|
</Provider>,
|
|
70
69
|
);
|
|
71
70
|
});
|
|
@@ -73,9 +72,9 @@ describe("Loader placeholder", () => {
|
|
|
73
72
|
});
|
|
74
73
|
|
|
75
74
|
describe("Loader", () => {
|
|
76
|
-
let clock,
|
|
75
|
+
let clock, componentLoader, errorLoader;
|
|
77
76
|
beforeEach(() => {
|
|
78
|
-
|
|
77
|
+
componentLoader = () => import("./ColumnWrapper");
|
|
79
78
|
errorLoader = () => Promise.reject(new Error("This is not right"));
|
|
80
79
|
clock = sinon.useFakeTimers();
|
|
81
80
|
});
|
|
@@ -85,13 +84,13 @@ describe("Loader", () => {
|
|
|
85
84
|
spyOnConsole(["error"]);
|
|
86
85
|
|
|
87
86
|
it("loads the component", () => {
|
|
88
|
-
const Comp = Loader(
|
|
87
|
+
const Comp = Loader(componentLoader);
|
|
89
88
|
const loader = mount(
|
|
90
|
-
<
|
|
89
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
91
90
|
<div>
|
|
92
91
|
<Comp />
|
|
93
92
|
</div>
|
|
94
|
-
</
|
|
93
|
+
</TestWrapper>,
|
|
95
94
|
);
|
|
96
95
|
expect(loader, "to satisfy", <div />);
|
|
97
96
|
act(() => {
|
|
@@ -99,12 +98,12 @@ describe("Loader", () => {
|
|
|
99
98
|
});
|
|
100
99
|
expect(
|
|
101
100
|
loader,
|
|
102
|
-
"queried for first",
|
|
103
|
-
"svg",
|
|
104
101
|
"to satisfy",
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
102
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
103
|
+
<div>
|
|
104
|
+
<LoadingIcon />
|
|
105
|
+
</div>
|
|
106
|
+
</TestWrapper>,
|
|
108
107
|
);
|
|
109
108
|
let load;
|
|
110
109
|
act(() => {
|
|
@@ -114,29 +113,29 @@ describe("Loader", () => {
|
|
|
114
113
|
expect(
|
|
115
114
|
loader,
|
|
116
115
|
"to satisfy",
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
|
|
116
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
117
|
+
<div>
|
|
118
|
+
<ColumnWrapper />
|
|
119
|
+
</div>
|
|
120
|
+
</TestWrapper>,
|
|
120
121
|
).then(() => expect(console.error, "was not called")),
|
|
121
122
|
);
|
|
122
123
|
});
|
|
123
124
|
|
|
124
125
|
it("errors out", () => {
|
|
125
126
|
const Comp = Loader(errorLoader);
|
|
127
|
+
const store = {
|
|
128
|
+
subscribe: () => {},
|
|
129
|
+
dispatch: () => {},
|
|
130
|
+
getState: () => ({}),
|
|
131
|
+
};
|
|
132
|
+
|
|
126
133
|
const loader = mount(
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
<ThemeProvider theme={{}}>
|
|
135
|
-
<div>
|
|
136
|
-
<Comp />
|
|
137
|
-
</div>
|
|
138
|
-
</ThemeProvider>
|
|
139
|
-
</Provider>,
|
|
134
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }}>
|
|
135
|
+
<div>
|
|
136
|
+
<Comp />
|
|
137
|
+
</div>
|
|
138
|
+
</TestWrapper>,
|
|
140
139
|
);
|
|
141
140
|
expect(loader, "to satisfy", <div />);
|
|
142
141
|
act(() => {
|
|
@@ -144,12 +143,12 @@ describe("Loader", () => {
|
|
|
144
143
|
});
|
|
145
144
|
expect(
|
|
146
145
|
loader,
|
|
147
|
-
"queried for first",
|
|
148
|
-
"svg",
|
|
149
146
|
"to satisfy",
|
|
150
|
-
<
|
|
151
|
-
<
|
|
152
|
-
|
|
147
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
148
|
+
<div>
|
|
149
|
+
<LoadingIcon />
|
|
150
|
+
</div>
|
|
151
|
+
</TestWrapper>,
|
|
153
152
|
);
|
|
154
153
|
let load;
|
|
155
154
|
act(() => {
|
|
@@ -159,19 +158,11 @@ describe("Loader", () => {
|
|
|
159
158
|
expect(
|
|
160
159
|
loader,
|
|
161
160
|
"to satisfy",
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<ThemeProvider theme={{}}>
|
|
170
|
-
<div>
|
|
171
|
-
<ErrorPlaceholder message="This is not right" />
|
|
172
|
-
</div>
|
|
173
|
-
</ThemeProvider>
|
|
174
|
-
</Provider>,
|
|
161
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }}>
|
|
162
|
+
<div>
|
|
163
|
+
<ErrorPlaceholder message="This is not right" />
|
|
164
|
+
</div>
|
|
165
|
+
</TestWrapper>,
|
|
175
166
|
).then(() => expect(console.error, "was called")),
|
|
176
167
|
);
|
|
177
168
|
});
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import Placeholder from "./Placeholder";
|
|
2
|
+
import CircularProgress from "@material-ui/core/CircularProgress";
|
|
3
|
+
import { makeStyles } from "@material-ui/core";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const useStyles = makeStyles(theme => ({
|
|
6
|
+
progressContainer: {
|
|
7
|
+
top: 0,
|
|
8
|
+
left: 0,
|
|
9
|
+
right: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
display: "flex",
|
|
12
|
+
position: "fixed",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
zIndex: 999,
|
|
16
|
+
},
|
|
17
|
+
progress: {
|
|
18
|
+
color: theme.palette.primary.main,
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
14
21
|
|
|
15
|
-
const LoadingIcon =
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
const LoadingIcon = () => {
|
|
23
|
+
const classes = useStyles();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={classes.progressContainer}>
|
|
27
|
+
<CircularProgress className={classes.progress} size={100} color="inherit" />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
18
31
|
|
|
19
32
|
export default LoadingIcon;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import Placeholder from "./Placeholder";
|
|
2
|
+
import CircularProgress from "@material-ui/core/CircularProgress";
|
|
4
3
|
import LoadingIcon from "./LoadingIcon";
|
|
4
|
+
import { createMuiTheme, TestWrapper } from "../utils/testUtils";
|
|
5
|
+
|
|
6
|
+
const theme = createMuiTheme();
|
|
5
7
|
|
|
6
8
|
describe("LoadingIcon", () => {
|
|
7
9
|
it("shows a spinning load icon", () =>
|
|
8
10
|
expect(
|
|
9
|
-
<
|
|
10
|
-
<LoadingIcon />
|
|
11
|
-
</ThemeProvider>,
|
|
12
|
-
"when mounted",
|
|
13
|
-
"to satisfy",
|
|
14
|
-
<Placeholder icon="loading" animate />,
|
|
15
|
-
));
|
|
16
|
-
|
|
17
|
-
it("gets icon from theme", () =>
|
|
18
|
-
expect(
|
|
19
|
-
<ThemeProvider theme={{ icons: { loading: "spinner" } }}>
|
|
11
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
20
12
|
<LoadingIcon />
|
|
21
|
-
</
|
|
13
|
+
</TestWrapper>,
|
|
22
14
|
"when mounted",
|
|
23
15
|
"to satisfy",
|
|
24
|
-
<
|
|
16
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
17
|
+
<div>
|
|
18
|
+
<CircularProgress size={100} color="inherit" />
|
|
19
|
+
</div>
|
|
20
|
+
</TestWrapper>,
|
|
25
21
|
));
|
|
26
22
|
});
|
|
@@ -24,12 +24,12 @@ const useStyles = makeStyles(theme => ({
|
|
|
24
24
|
},
|
|
25
25
|
containerWide: {
|
|
26
26
|
width: theme.spacing(106.4),
|
|
27
|
-
height: `calc(100% -
|
|
27
|
+
height: `calc(100% - ${theme.spacing(8)})`,
|
|
28
28
|
maxHeight: theme.spacing(73),
|
|
29
29
|
},
|
|
30
30
|
containerFullwidth: {
|
|
31
|
-
width: `calc(100% -
|
|
32
|
-
height: `calc(100% -
|
|
31
|
+
width: `calc(100% - ${theme.spacing(8)})`,
|
|
32
|
+
height: `calc(100% - ${theme.spacing(8)})`,
|
|
33
33
|
},
|
|
34
34
|
title: {
|
|
35
35
|
height: theme.spacing(4),
|
|
@@ -44,18 +44,18 @@ const useStyles = makeStyles(theme => ({
|
|
|
44
44
|
},
|
|
45
45
|
textSkeleton: {
|
|
46
46
|
width: "100%",
|
|
47
|
-
height: 6,
|
|
47
|
+
height: theme.spacing(0.6),
|
|
48
48
|
animation: false,
|
|
49
49
|
},
|
|
50
50
|
chipSkeleton: {
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
51
|
+
width: theme.spacing(6),
|
|
52
|
+
height: theme.spacing(2.5),
|
|
53
53
|
animation: false,
|
|
54
|
-
borderRadius:
|
|
54
|
+
borderRadius: theme.spacing(1.5),
|
|
55
55
|
},
|
|
56
56
|
radioSkeleton: {
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
57
|
+
width: theme.spacing(1.7),
|
|
58
|
+
height: theme.spacing(1.7),
|
|
59
59
|
animation: false,
|
|
60
60
|
},
|
|
61
61
|
root: {
|