orc-shared 5.10.2 → 5.99.0-dev.10
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/Form/Inputs/MultiSelector.js +137 -0
- package/dist/components/Form/Inputs/Selector.js +13 -10
- 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 +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- 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/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/Select.js +175 -109
- package/dist/components/MaterialUI/Inputs/SelectProps.js +11 -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 +3 -1
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +117 -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/{components/Modal/index.js → hooks/useWindowSize.js} +38 -36
- package/dist/sharedMessages.js +8 -0
- 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 +73 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +332 -0
- package/src/components/Form/Inputs/Selector.js +12 -4
- package/src/components/Form/Inputs/Selector.test.js +27 -12
- 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 +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- 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/PredefinedElements/SearchControl.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +143 -83
- package/src/components/MaterialUI/Inputs/Select.test.js +199 -14
- package/src/components/MaterialUI/Inputs/SelectProps.js +10 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +10 -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 +4 -1
- 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/hooks/useMultipleFieldEditState.test.js +0 -1
- package/src/hooks/useWindowSize.js +39 -0
- package/src/hooks/useWindowSize.test.js +68 -0
- package/src/sharedMessages.js +8 -0
- package/src/translations/en-US.json +2 -0
- package/src/translations/fr-CA.json +2 -0
- 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/IconButton.js +0 -80
- 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/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,17 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Provider } from "react-redux";
|
|
3
|
-
import { MemoryRouter } from "react-router-dom";
|
|
4
2
|
import Immutable from "immutable";
|
|
5
3
|
import { mount } from "enzyme";
|
|
4
|
+
import { ScopeIcon } from "../MaterialUI/ScopeSelector/TreeItem";
|
|
6
5
|
import sinon from "sinon";
|
|
7
|
-
import
|
|
8
|
-
import { ScopeIcon, ContentLabel, ScopeNode, ScopeText } from "./ScopeNode";
|
|
6
|
+
import { ScopeNode } from "./ScopeNode";
|
|
9
7
|
import { TestWrapper } from "../../utils/testUtils";
|
|
8
|
+
import { createMuiTheme } from "../../utils/testUtils";
|
|
9
|
+
|
|
10
|
+
const theme = createMuiTheme();
|
|
10
11
|
|
|
11
12
|
describe("ScopeNode", () => {
|
|
12
|
-
let
|
|
13
|
+
let onClick, store;
|
|
13
14
|
beforeEach(() => {
|
|
14
|
-
|
|
15
|
+
onClick = sinon.spy().named("onClick");
|
|
15
16
|
store = {
|
|
16
17
|
subscribe: () => {},
|
|
17
18
|
dispatch: () => {},
|
|
@@ -24,208 +25,128 @@ describe("ScopeNode", () => {
|
|
|
24
25
|
|
|
25
26
|
it("displays an icon and a label for a scope", () =>
|
|
26
27
|
expect(
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
</MemoryRouter>
|
|
31
|
-
</Provider>,
|
|
28
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
29
|
+
<ScopeNode name="A scope" type="test" scopeId="ScopeId" isAuthorizedScope={true} />
|
|
30
|
+
</TestWrapper>,
|
|
32
31
|
"when mounted",
|
|
33
32
|
"to satisfy",
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
34
|
+
<div id="selectorNodeScopeId">
|
|
35
|
+
<ScopeIcon type="test" />
|
|
36
|
+
<div>A scope</div>
|
|
37
|
+
</div>
|
|
38
|
+
</TestWrapper>,
|
|
38
39
|
));
|
|
39
40
|
|
|
40
41
|
it("displays an icon and a label for the global scope", () =>
|
|
41
42
|
expect(
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
</MemoryRouter>
|
|
46
|
-
</Provider>,
|
|
43
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
44
|
+
<ScopeNode name="A scope" type="Global" scopeId="ScopeId" isAuthorizedScope={true} />
|
|
45
|
+
</TestWrapper>,
|
|
47
46
|
"when mounted",
|
|
48
47
|
"to satisfy",
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
49
|
+
<div id="selectorNodeScopeId">
|
|
50
|
+
<ScopeIcon type="Global" />
|
|
51
|
+
<div>A scope</div>
|
|
52
|
+
</div>
|
|
53
|
+
</TestWrapper>,
|
|
53
54
|
));
|
|
54
55
|
|
|
55
56
|
it("displays an icon and a label for an unauthorized scope", () =>
|
|
56
57
|
expect(
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
</MemoryRouter>
|
|
61
|
-
</Provider>,
|
|
58
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
59
|
+
<ScopeNode name="A scope" type="test" scopeId="ScopeId" />
|
|
60
|
+
</TestWrapper>,
|
|
62
61
|
"when mounted",
|
|
63
62
|
"to satisfy",
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
64
|
+
<div id="selectorNodeScopeId">
|
|
65
|
+
<ScopeIcon type="test" />
|
|
66
|
+
<div>A scope</div>
|
|
67
|
+
</div>
|
|
68
|
+
</TestWrapper>,
|
|
68
69
|
));
|
|
69
70
|
|
|
70
71
|
it("displays an icon and a the fallback id for a scope when name is undefined", () =>
|
|
71
72
|
expect(
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
</MemoryRouter>
|
|
76
|
-
</Provider>,
|
|
73
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
74
|
+
<ScopeNode type="test" scopeId="ScopeId" isAuthorizedScope={true} />
|
|
75
|
+
</TestWrapper>,
|
|
77
76
|
"when mounted",
|
|
78
77
|
"to satisfy",
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
79
|
+
<div id="selectorNodeScopeId">
|
|
80
|
+
<ScopeIcon type="test" />
|
|
81
|
+
<div>ScopeId</div>
|
|
82
|
+
</div>
|
|
83
|
+
</TestWrapper>,
|
|
83
84
|
));
|
|
84
85
|
|
|
85
86
|
it("displays an icon and a the fallback id for a scope when name is null", () =>
|
|
86
87
|
expect(
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
</MemoryRouter>
|
|
91
|
-
</Provider>,
|
|
88
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
89
|
+
<ScopeNode name={null} type="test" scopeId="ScopeId" isAuthorizedScope={true} />
|
|
90
|
+
</TestWrapper>,
|
|
92
91
|
"when mounted",
|
|
93
92
|
"to satisfy",
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
94
|
+
<div id="selectorNodeScopeId">
|
|
95
|
+
<ScopeIcon type="test" />
|
|
96
|
+
<div>ScopeId</div>
|
|
97
|
+
</div>
|
|
98
|
+
</TestWrapper>,
|
|
98
99
|
));
|
|
99
100
|
|
|
100
101
|
it("handles virtual scopes", () =>
|
|
101
102
|
expect(
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</
|
|
112
|
-
</
|
|
103
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
104
|
+
<ScopeNode name="A scope" type="Virtual" scopeId="ScopeId" isAuthorizedScope={true} />
|
|
105
|
+
</TestWrapper>,
|
|
106
|
+
"when mounted",
|
|
107
|
+
"to satisfy",
|
|
108
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
109
|
+
<div id="selectorNodeScopeId">
|
|
110
|
+
<ScopeIcon type="Virtual" />
|
|
111
|
+
<div>A scope</div>
|
|
112
|
+
</div>
|
|
113
|
+
</TestWrapper>,
|
|
114
|
+
));
|
|
115
|
+
|
|
116
|
+
it("displays an icon without label for a scope with custom children", () =>
|
|
117
|
+
expect(
|
|
118
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
119
|
+
<ScopeNode type="test" isAuthorizedScope={true}>
|
|
120
|
+
<div>Another Display Test</div>
|
|
121
|
+
</ScopeNode>
|
|
122
|
+
</TestWrapper>,
|
|
113
123
|
"when mounted",
|
|
114
124
|
"to satisfy",
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
126
|
+
<div id="selectorNodescopeUnknown">
|
|
127
|
+
<ScopeIcon type="test" />
|
|
128
|
+
<div>Another Display Test</div>
|
|
129
|
+
</div>
|
|
130
|
+
</TestWrapper>,
|
|
119
131
|
));
|
|
120
132
|
|
|
121
|
-
it("Call
|
|
133
|
+
it("Call onClick on Node click when defined", () => {
|
|
122
134
|
const component = (
|
|
123
|
-
<TestWrapper provider={{ store }} memoryRouter>
|
|
124
|
-
<ScopeNode name="A scope" type="test"
|
|
135
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }} memoryRouter={{}}>
|
|
136
|
+
<ScopeNode name="A scope" type="test" scopeId="ScopeId" onClick={onClick} isAuthorizedScope={true} />
|
|
125
137
|
</TestWrapper>
|
|
126
138
|
);
|
|
127
139
|
|
|
128
|
-
const preventDefaultSpy = sinon.spy();
|
|
129
|
-
|
|
130
140
|
const mountedComponent = mount(component);
|
|
131
141
|
|
|
132
142
|
const event = {
|
|
133
|
-
preventDefault:
|
|
143
|
+
preventDefault: () => {},
|
|
134
144
|
};
|
|
135
145
|
|
|
136
|
-
const node = mountedComponent.find(
|
|
146
|
+
const node = mountedComponent.find("[data-qa='content-label']").first();
|
|
137
147
|
|
|
138
148
|
node.invoke("onClick")(event);
|
|
139
149
|
|
|
140
|
-
expect(
|
|
141
|
-
expect(closeSelector, "to have a call satisfying", { args: [event] });
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe("ContentLabel", () => {
|
|
146
|
-
let onClick;
|
|
147
|
-
beforeEach(() => {
|
|
148
|
-
onClick = () => {};
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("sets css for authorized Global scope", () =>
|
|
152
|
-
expect(
|
|
153
|
-
<ContentLabel id="selectorNodeScopeId" isGlobal={true} onClick={onClick} />,
|
|
154
|
-
"when mounted",
|
|
155
|
-
"to have style rules satisfying",
|
|
156
|
-
expect
|
|
157
|
-
.it("to contain", "text-transform: uppercase;")
|
|
158
|
-
.and("to contain", ":hover {background-color: #222;}")
|
|
159
|
-
.and("not to contain", "color: #999999")
|
|
160
|
-
.and("not to contain", "cursor: default;"),
|
|
161
|
-
));
|
|
162
|
-
|
|
163
|
-
it("sets css for unauthorized Global scope", () =>
|
|
164
|
-
expect(
|
|
165
|
-
<ContentLabel id="selectorNodeScopeId" isGlobal={true} />,
|
|
166
|
-
"when mounted",
|
|
167
|
-
"to have style rules satisfying",
|
|
168
|
-
expect
|
|
169
|
-
.it("to contain", "text-transform: uppercase;")
|
|
170
|
-
.and("not to contain", ":hover {background-color: #222;}")
|
|
171
|
-
.and("to contain", "color: #999999")
|
|
172
|
-
.and("to contain", "cursor: default;"),
|
|
173
|
-
));
|
|
174
|
-
|
|
175
|
-
it("sets css for a not-clickable and a non-global scope", () =>
|
|
176
|
-
expect(
|
|
177
|
-
<ContentLabel isGlobal={false} />,
|
|
178
|
-
"when mounted",
|
|
179
|
-
"to have style rules satisfying",
|
|
180
|
-
expect
|
|
181
|
-
.it("not to contain", "text-transform: uppercase;")
|
|
182
|
-
.and("not to contain", ":hover {background-color: #222;}")
|
|
183
|
-
.and("to contain", "color: #999999")
|
|
184
|
-
.and("to contain", "cursor: default;"),
|
|
185
|
-
));
|
|
186
|
-
|
|
187
|
-
it("sets css for a clickable and a non-global scope", () =>
|
|
188
|
-
expect(
|
|
189
|
-
<ContentLabel isGlobal={false} onClick={onClick} />,
|
|
190
|
-
"when mounted",
|
|
191
|
-
"to have style rules satisfying",
|
|
192
|
-
expect
|
|
193
|
-
.it("not to contain", "text-transform: uppercase;")
|
|
194
|
-
.and("to contain", ":hover {background-color: #222;}")
|
|
195
|
-
.and("not to contain", "color: #999999")
|
|
196
|
-
.and("not to contain", "cursor: default;"),
|
|
197
|
-
));
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
describe("ScopeIcon", () => {
|
|
201
|
-
let theme;
|
|
202
|
-
beforeEach(() => {
|
|
203
|
-
theme = {
|
|
204
|
-
icons: {
|
|
205
|
-
scopeTypes: {
|
|
206
|
-
Test: "test-icon",
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
colors: {
|
|
210
|
-
scopeTypes: {
|
|
211
|
-
Test: "#00ff00",
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
};
|
|
150
|
+
expect(onClick, "to have a call satisfying", { args: [event] });
|
|
215
151
|
});
|
|
216
|
-
|
|
217
|
-
it("renders an icon with id based on scope type", () =>
|
|
218
|
-
expect(<ScopeIcon theme={theme} type="Test" />, "when mounted", "to satisfy", <Icon id="test-icon" />));
|
|
219
|
-
|
|
220
|
-
it("renders in a color based on scope type", () =>
|
|
221
|
-
expect(
|
|
222
|
-
<ScopeIcon theme={theme} type="Test" />,
|
|
223
|
-
"when mounted",
|
|
224
|
-
"to have style rules satisfying",
|
|
225
|
-
"to contain",
|
|
226
|
-
"color: #00ff00;",
|
|
227
|
-
));
|
|
228
|
-
|
|
229
|
-
it("by default renders a cross", () =>
|
|
230
|
-
expect(<ScopeIcon theme={theme} type="N/A" />, "when mounted", "to satisfy", <Icon id="cross" />));
|
|
231
152
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Immutable from "immutable";
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
|
-
import { ThemeProvider } from "styled-components";
|
|
5
4
|
import ScopeExtendedConfigurationLoader from "./ScopeExtendedConfigurationLoader";
|
|
6
5
|
import { mount } from "enzyme";
|
|
7
6
|
import { getScopeExtendedConfiguration } from "../actions/scopes";
|
|
@@ -58,9 +57,7 @@ describe("ScopeExtendedConfigurationLoader", () => {
|
|
|
58
57
|
|
|
59
58
|
const component = (
|
|
60
59
|
<Provider store={theStore}>
|
|
61
|
-
<
|
|
62
|
-
<ScopeExtendedConfigurationLoader />
|
|
63
|
-
</ThemeProvider>
|
|
60
|
+
<ScopeExtendedConfigurationLoader />
|
|
64
61
|
</Provider>
|
|
65
62
|
);
|
|
66
63
|
|
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const panelWidth = getProp("width");
|
|
3
|
+
import { CSSTransition } from "react-transition-group";
|
|
4
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
5
|
+
import classNames from "classnames";
|
|
8
6
|
|
|
9
7
|
const getModalRoot = () => document.getElementById("modal");
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
const useStyles = makeStyles(theme => ({
|
|
10
|
+
panel: props => ({
|
|
11
|
+
position: "absolute",
|
|
12
|
+
top: 0,
|
|
13
|
+
bottom: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
width: theme.spacing(props.widthSpacing),
|
|
16
|
+
|
|
17
|
+
"&.enter": {
|
|
18
|
+
transform: `translateX(${theme.spacing(props.widthSpacing)})`,
|
|
19
|
+
},
|
|
20
|
+
"&.enter-active": {
|
|
21
|
+
transform: "translateX(0)",
|
|
22
|
+
transition: `transform ${props.timeout}ms ease-out`,
|
|
23
|
+
},
|
|
24
|
+
"&.exit": {
|
|
25
|
+
transform: "translateX(0)",
|
|
26
|
+
},
|
|
27
|
+
"&.exit-active": {
|
|
28
|
+
transform: `translateX(${theme.spacing(props.widthSpacing)})`,
|
|
29
|
+
transition: `transform ${props.timeout}ms ease-out`,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const Sidepanel = ({ in: inProp, widthSpacing = 30, timeout = 1000, children, className }) => {
|
|
35
|
+
const classes = useStyles({ widthSpacing, timeout });
|
|
36
|
+
|
|
37
|
+
const panel = (
|
|
38
|
+
<CSSTransition in={inProp} timeout={timeout} unmountOnExit>
|
|
39
|
+
<div className={classNames(classes.panel, className)}>{children}</div>
|
|
40
|
+
</CSSTransition>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return ReactDOM.createPortal(panel, getModalRoot());
|
|
36
44
|
};
|
|
37
45
|
|
|
38
|
-
const Sidepanel = props => ReactDOM.createPortal(<PanelDrawer {...props} />, getModalRoot());
|
|
39
|
-
|
|
40
46
|
export default Sidepanel;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
|
-
import Sidepanel
|
|
3
|
+
import Sidepanel from "./Sidepanel";
|
|
4
|
+
import { createMuiTheme, TestWrapper } from "../utils/testUtils";
|
|
5
|
+
|
|
6
|
+
const theme = createMuiTheme();
|
|
4
7
|
|
|
5
8
|
class RenderSidepanel extends React.Component {
|
|
6
9
|
render() {
|
|
@@ -32,7 +35,7 @@ describe("Sidepanel", () => {
|
|
|
32
35
|
document.body.removeChild(modalRoot);
|
|
33
36
|
});
|
|
34
37
|
|
|
35
|
-
it("renders
|
|
38
|
+
it("renders sidepanel in a portal", () => {
|
|
36
39
|
ReactDOM.render(
|
|
37
40
|
<RenderSidepanel in>
|
|
38
41
|
<div id="inner">Foo</div>
|
|
@@ -42,32 +45,56 @@ describe("Sidepanel", () => {
|
|
|
42
45
|
return expect(modalRoot, "queried for first", "div#inner", "to be a", "DOMElement");
|
|
43
46
|
});
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
it("sets the width it is given", () => {
|
|
49
|
+
ReactDOM.render(
|
|
50
|
+
<TestWrapper muiThemeProvider={{ theme }}>
|
|
51
|
+
<Sidepanel in widthSpacing={25}>
|
|
52
|
+
<div id="inner">Foo</div>
|
|
53
|
+
</Sidepanel>
|
|
54
|
+
</TestWrapper>,
|
|
55
|
+
appRoot,
|
|
56
|
+
);
|
|
57
|
+
return expect(
|
|
58
|
+
modalRoot,
|
|
59
|
+
"queried for first",
|
|
60
|
+
"div#modal > div",
|
|
61
|
+
"to have style rules satisfying",
|
|
62
|
+
"to contain",
|
|
63
|
+
"width: 15.625rem",
|
|
64
|
+
);
|
|
65
|
+
});
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
it("sets transition according to timeout", () => {
|
|
68
|
+
ReactDOM.render(
|
|
69
|
+
<Sidepanel in timeout={300}>
|
|
70
|
+
<div id="inner">Foo</div>
|
|
71
|
+
</Sidepanel>,
|
|
72
|
+
appRoot,
|
|
73
|
+
);
|
|
74
|
+
return expect(
|
|
75
|
+
modalRoot,
|
|
76
|
+
"queried for first",
|
|
77
|
+
"div#modal > div",
|
|
78
|
+
"to have style rules satisfying",
|
|
79
|
+
"to contain",
|
|
80
|
+
"transition: transform 300ms",
|
|
81
|
+
);
|
|
82
|
+
});
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
it("sets default transition", () => {
|
|
85
|
+
ReactDOM.render(
|
|
86
|
+
<Sidepanel in>
|
|
87
|
+
<div id="inner">Foo</div>
|
|
88
|
+
</Sidepanel>,
|
|
89
|
+
appRoot,
|
|
90
|
+
);
|
|
91
|
+
return expect(
|
|
92
|
+
modalRoot,
|
|
93
|
+
"queried for first",
|
|
94
|
+
"div#modal > div",
|
|
95
|
+
"to have style rules satisfying",
|
|
96
|
+
"to contain",
|
|
97
|
+
"transition: transform 1000ms",
|
|
98
|
+
);
|
|
72
99
|
});
|
|
73
100
|
});
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import Icon from "./Icon";
|
|
2
|
+
import { makeStyles } from "@material-ui/core";
|
|
3
|
+
import Icon from "./MaterialUI/DataDisplay/Icon";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const useStyles = makeStyles(theme => ({
|
|
6
|
+
wrapper: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexWrap: "wrap",
|
|
9
|
+
justifyContent: "space-around",
|
|
10
|
+
overflowY: "auto",
|
|
11
|
+
height: "100%",
|
|
12
|
+
},
|
|
13
|
+
iconBlock: {
|
|
14
|
+
flex: "0 0 30%",
|
|
15
|
+
border: "1px solid #999",
|
|
16
|
+
margin: theme.spacing(0.5),
|
|
17
|
+
padding: theme.spacing(0.5, 1),
|
|
18
|
+
fontSize: theme.spacing(2.4),
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
20
21
|
|
|
21
22
|
const arrify = thing => [].slice.call(thing);
|
|
22
23
|
|
|
23
24
|
const SpriteSheet = () => {
|
|
25
|
+
const classes = useStyles();
|
|
24
26
|
const iconIds = arrify(document.querySelectorAll('symbol[id^="icon-"]')).map(elm => elm.id.replace(/^icon-/, ""));
|
|
25
27
|
return (
|
|
26
|
-
<
|
|
28
|
+
<div className={classes.wrapper}>
|
|
27
29
|
{iconIds.map(id => (
|
|
28
|
-
<
|
|
30
|
+
<div className={classes.iconBlock} key={id}>
|
|
29
31
|
<Icon id={id} /> {id}
|
|
30
|
-
</
|
|
32
|
+
</div>
|
|
31
33
|
))}
|
|
32
|
-
</
|
|
34
|
+
</div>
|
|
33
35
|
);
|
|
34
36
|
};
|
|
35
37
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Spritesheet
|
|
3
|
-
import Icon from "./Icon";
|
|
2
|
+
import Spritesheet from "./Spritesheet";
|
|
3
|
+
import Icon from "./MaterialUI/DataDisplay/Icon";
|
|
4
4
|
|
|
5
5
|
describe("Spritesheet", () => {
|
|
6
6
|
beforeEach(() => {
|
|
@@ -19,16 +19,16 @@ describe("Spritesheet", () => {
|
|
|
19
19
|
<Spritesheet />,
|
|
20
20
|
"when mounted",
|
|
21
21
|
"to satisfy",
|
|
22
|
-
<
|
|
23
|
-
<
|
|
22
|
+
<div>
|
|
23
|
+
<div>
|
|
24
24
|
<Icon id="test-1" /> {"test-1"}
|
|
25
|
-
</
|
|
26
|
-
<
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
27
|
<Icon id="test-2" /> {"test-2"}
|
|
28
|
-
</
|
|
29
|
-
<
|
|
28
|
+
</div>
|
|
29
|
+
<div>
|
|
30
30
|
<Icon id="test-3" /> {"test-3"}
|
|
31
|
-
</
|
|
32
|
-
</
|
|
31
|
+
</div>
|
|
32
|
+
</div>,
|
|
33
33
|
));
|
|
34
34
|
});
|
package/src/components/Text.js
CHANGED
|
@@ -1,50 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import pt from "prop-types";
|
|
3
|
-
import styled, { keyframes } from "styled-components";
|
|
4
|
-
import { getThemeProp } from "../utils";
|
|
5
|
-
import withErrorBoundary from "../hocs/withErrorBoundary";
|
|
6
|
-
import useLabelMessage from "../hooks/useLabelMessage";
|
|
7
|
-
|
|
8
|
-
const fadeCycle = keyframes`
|
|
9
|
-
0% {
|
|
10
|
-
opacity: 0.3;
|
|
11
|
-
}
|
|
12
|
-
100% {
|
|
13
|
-
opacity: 0.7;
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
export const Placeholder = styled.span`
|
|
18
|
-
display: inline-block;
|
|
19
|
-
height: 1em;
|
|
20
|
-
width: 6em;
|
|
21
|
-
border-radius: 0.5em;
|
|
22
|
-
background-color: ${getThemeProp(["colors", "textMedium"], "#999999")};
|
|
23
|
-
animation: ${fadeCycle} 3s infinite alternate;
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
const Text = ({ message: rawMessage, error }) => {
|
|
27
|
-
const [labelMessage, missingValues] = useLabelMessage(rawMessage);
|
|
28
|
-
|
|
29
|
-
if (error || (!rawMessage && rawMessage !== "")) {
|
|
30
|
-
return (
|
|
31
|
-
<span
|
|
32
|
-
style={{
|
|
33
|
-
color: "red",
|
|
34
|
-
backgroundColor: "white",
|
|
35
|
-
fontWeight: "bold",
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
Errored: {error && error.message ? error.message : "No message provided"}
|
|
39
|
-
</span>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (missingValues) {
|
|
44
|
-
return <Placeholder />;
|
|
45
|
-
}
|
|
46
|
-
return labelMessage;
|
|
47
|
-
};
|
|
48
2
|
|
|
49
3
|
export const ptLabel = pt.oneOfType([
|
|
50
4
|
pt.string,
|
|
@@ -53,6 +7,3 @@ export const ptLabel = pt.oneOfType([
|
|
|
53
7
|
defaultMessage: pt.string.isRequired,
|
|
54
8
|
}),
|
|
55
9
|
]);
|
|
56
|
-
Text.propTypes = { message: ptLabel };
|
|
57
|
-
|
|
58
|
-
export default withErrorBoundary("Text")(Text);
|