orc-shared 5.10.1-dev.7 → 5.10.1-dev.9
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/Authenticate.js +41 -17
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/{Icon.js → Form/Inputs/MultiSelector.js} +33 -20
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/LoadingIcon.js +6 -16
- package/dist/components/MaterialUI/Inputs/Select.js +10 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +115 -56
- package/dist/components/Scope/ScopeNode.js +68 -45
- package/dist/components/Sidepanel.js +57 -23
- package/dist/components/Spritesheet.js +33 -17
- package/dist/components/Text.js +1 -60
- 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 +7 -5
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/package.json +1 -1
- package/src/components/ApplicationModuleLoader.test.js +14 -27
- package/src/components/Authenticate.js +29 -21
- package/src/components/Authenticate.test.js +18 -27
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/InputField.test.js +2 -1
- 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/Loader.test.js +21 -33
- package/src/components/LoadingIcon.js +2 -15
- package/src/components/LoadingIcon.test.js +2 -20
- package/src/components/MaterialUI/DataDisplay/Table.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/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- 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 +61 -54
- package/src/components/Scope/ScopeNode.test.js +61 -154
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +49 -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/Treeview/Branch.js +63 -45
- package/src/components/Treeview/Branch.test.js +21 -24
- package/src/components/Treeview/Label.js +66 -52
- package/src/components/Treeview/Label.test.js +42 -60
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +15 -10
- 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 +7 -6
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/dist/components/Button.js +0 -70
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/IconButton.js +0 -80
- package/dist/components/Input.js +0 -101
- package/dist/components/Modal/Background.js +0 -55
- 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 -153
- 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/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/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 -98
- 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,404 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom";
|
|
3
|
-
import { act } from "react-dom/test-utils";
|
|
4
|
-
import { Provider } from "react-redux";
|
|
5
|
-
import { Router, MemoryRouter } from "react-router-dom";
|
|
6
|
-
import { IntlProvider } from "react-intl";
|
|
7
|
-
import sinon from "sinon";
|
|
8
|
-
import { createMemoryHistory } from "history";
|
|
9
|
-
import { Ignore } from "unexpected-reaction";
|
|
10
|
-
import { getClassSelector, getStyledClassSelector } from "../../utils/testUtils";
|
|
11
|
-
import Tab, { PageTab, ModuleTab, TabLink, ModuleIcon, TabText, CloseIcon } from "./Tab";
|
|
12
|
-
import { Placeholder } from "../Text";
|
|
13
|
-
|
|
14
|
-
describe("Tab", () => {
|
|
15
|
-
let history, close;
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
history = createMemoryHistory();
|
|
18
|
-
close = sinon.spy().named("close");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("renders a module tab with icon and label", () =>
|
|
22
|
-
expect(
|
|
23
|
-
<Provider
|
|
24
|
-
store={{
|
|
25
|
-
subscribe: () => {},
|
|
26
|
-
dispatch: () => {},
|
|
27
|
-
getState: () => ({}),
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<Router history={history}>
|
|
31
|
-
<IntlProvider locale="en">
|
|
32
|
-
<Tab module icon="test" label="A module" href="/Foo/modu" />
|
|
33
|
-
</IntlProvider>
|
|
34
|
-
</Router>
|
|
35
|
-
</Provider>,
|
|
36
|
-
"when mounted",
|
|
37
|
-
"with event",
|
|
38
|
-
{
|
|
39
|
-
type: "click",
|
|
40
|
-
target: getClassSelector(
|
|
41
|
-
<MemoryRouter>
|
|
42
|
-
<TabLink to="/" />
|
|
43
|
-
</MemoryRouter>,
|
|
44
|
-
),
|
|
45
|
-
},
|
|
46
|
-
"to satisfy",
|
|
47
|
-
<Router history={history}>
|
|
48
|
-
<IntlProvider locale="en">
|
|
49
|
-
<ModuleTab>
|
|
50
|
-
<TabLink to="/Foo/modu">
|
|
51
|
-
<ModuleIcon id="test" />
|
|
52
|
-
<TabText>A module</TabText>
|
|
53
|
-
</TabLink>
|
|
54
|
-
</ModuleTab>
|
|
55
|
-
</IntlProvider>
|
|
56
|
-
</Router>,
|
|
57
|
-
));
|
|
58
|
-
|
|
59
|
-
it("renders an active module tab", () =>
|
|
60
|
-
expect(
|
|
61
|
-
<Provider
|
|
62
|
-
store={{
|
|
63
|
-
subscribe: () => {},
|
|
64
|
-
dispatch: () => {},
|
|
65
|
-
getState: () => ({}),
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<Router history={history}>
|
|
69
|
-
<IntlProvider locale="en">
|
|
70
|
-
<Tab module active icon="test" label={{ id: "test.module", defaultMessage: "A module" }} href="/Foo/modu" />
|
|
71
|
-
</IntlProvider>
|
|
72
|
-
</Router>
|
|
73
|
-
</Provider>,
|
|
74
|
-
"when mounted",
|
|
75
|
-
"to satisfy",
|
|
76
|
-
<Router history={history}>
|
|
77
|
-
<IntlProvider locale="en">
|
|
78
|
-
<ModuleTab active>
|
|
79
|
-
<TabLink to="/Foo/modu">
|
|
80
|
-
<ModuleIcon id="test" />
|
|
81
|
-
<TabText>A module</TabText>
|
|
82
|
-
</TabLink>
|
|
83
|
-
</ModuleTab>
|
|
84
|
-
</IntlProvider>
|
|
85
|
-
</Router>,
|
|
86
|
-
));
|
|
87
|
-
|
|
88
|
-
it("renders an active module tab with a very long label", () => {
|
|
89
|
-
// Needs to be fully rendered to work
|
|
90
|
-
const root = document.createElement("div");
|
|
91
|
-
document.body.append(root);
|
|
92
|
-
const history = createMemoryHistory();
|
|
93
|
-
sinon.spy(history, "push");
|
|
94
|
-
ReactDOM.render(
|
|
95
|
-
<Provider
|
|
96
|
-
store={{
|
|
97
|
-
subscribe: () => {},
|
|
98
|
-
dispatch: () => {},
|
|
99
|
-
getState: () => ({}),
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
<Router history={history}>
|
|
103
|
-
<IntlProvider locale="en">
|
|
104
|
-
<Tab
|
|
105
|
-
module
|
|
106
|
-
mustTruncate={true}
|
|
107
|
-
active
|
|
108
|
-
icon="test"
|
|
109
|
-
label={{ id: "test.module", defaultMessage: "A very long label" }}
|
|
110
|
-
href="/Foo/modu"
|
|
111
|
-
/>
|
|
112
|
-
</IntlProvider>
|
|
113
|
-
</Router>
|
|
114
|
-
</Provider>,
|
|
115
|
-
root,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const tab = root.querySelector("*"); // Get the first child
|
|
119
|
-
const tabLinkElement = tab.querySelector(getStyledClassSelector(TabLink));
|
|
120
|
-
const tabTextElement = tabLinkElement.querySelector(getStyledClassSelector(TabText));
|
|
121
|
-
|
|
122
|
-
act(() => {
|
|
123
|
-
// XXX: This is a nasty hack of jsdom, and may break unexpectedly
|
|
124
|
-
Object.defineProperty(tabTextElement, "offsetWidth", {
|
|
125
|
-
value: 10,
|
|
126
|
-
writable: true,
|
|
127
|
-
});
|
|
128
|
-
Object.defineProperty(tabTextElement, "scrollWidth", {
|
|
129
|
-
value: 20,
|
|
130
|
-
writable: true,
|
|
131
|
-
});
|
|
132
|
-
window.dispatchEvent(new Event("resize"));
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
act(() => {});
|
|
137
|
-
expect(
|
|
138
|
-
tab,
|
|
139
|
-
"to satisfy",
|
|
140
|
-
<Router history={history}>
|
|
141
|
-
<IntlProvider locale="en">
|
|
142
|
-
<ModuleTab active>
|
|
143
|
-
<TabLink to="/Foo/modu" mustTruncate={true}>
|
|
144
|
-
<ModuleIcon id="test" />
|
|
145
|
-
<TabText title="A very long label">A very long label</TabText>
|
|
146
|
-
</TabLink>
|
|
147
|
-
</ModuleTab>
|
|
148
|
-
</IntlProvider>
|
|
149
|
-
</Router>,
|
|
150
|
-
);
|
|
151
|
-
} finally {
|
|
152
|
-
ReactDOM.unmountComponentAtNode(root);
|
|
153
|
-
document.body.removeChild(root);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it("renders with a message error", () =>
|
|
158
|
-
expect(
|
|
159
|
-
<Provider
|
|
160
|
-
store={{
|
|
161
|
-
subscribe: () => {},
|
|
162
|
-
dispatch: () => {},
|
|
163
|
-
getState: () => ({}),
|
|
164
|
-
}}
|
|
165
|
-
>
|
|
166
|
-
<Router history={history}>
|
|
167
|
-
<IntlProvider locale="en">
|
|
168
|
-
<Tab
|
|
169
|
-
module
|
|
170
|
-
active
|
|
171
|
-
icon="test"
|
|
172
|
-
label={{ id: "test.module", defaultMessage: "A module {missingValue}" }}
|
|
173
|
-
href="/Foo/modu"
|
|
174
|
-
/>
|
|
175
|
-
</IntlProvider>
|
|
176
|
-
</Router>
|
|
177
|
-
</Provider>,
|
|
178
|
-
"when mounted",
|
|
179
|
-
"to satisfy",
|
|
180
|
-
<Router history={history}>
|
|
181
|
-
<IntlProvider locale="en">
|
|
182
|
-
<ModuleTab active>
|
|
183
|
-
<TabLink to="/Foo/modu">
|
|
184
|
-
<ModuleIcon id="test" />
|
|
185
|
-
<TabText>
|
|
186
|
-
<Placeholder />
|
|
187
|
-
</TabText>
|
|
188
|
-
</TabLink>
|
|
189
|
-
</ModuleTab>
|
|
190
|
-
</IntlProvider>
|
|
191
|
-
</Router>,
|
|
192
|
-
));
|
|
193
|
-
|
|
194
|
-
it("close a tab when scope is not supported", () =>
|
|
195
|
-
expect(
|
|
196
|
-
<Provider
|
|
197
|
-
store={{
|
|
198
|
-
subscribe: () => {},
|
|
199
|
-
dispatch: () => {},
|
|
200
|
-
getState: () => ({}),
|
|
201
|
-
}}
|
|
202
|
-
>
|
|
203
|
-
<Router history={history}>
|
|
204
|
-
<IntlProvider locale="en">
|
|
205
|
-
<Tab
|
|
206
|
-
label={{ id: "test.page", defaultMessage: "A page" }}
|
|
207
|
-
href="/Foo/modu"
|
|
208
|
-
close={close}
|
|
209
|
-
scopeNotSupported
|
|
210
|
-
/>
|
|
211
|
-
</IntlProvider>
|
|
212
|
-
</Router>
|
|
213
|
-
</Provider>,
|
|
214
|
-
"when mounted",
|
|
215
|
-
"to satisfy",
|
|
216
|
-
<Router history={history}>
|
|
217
|
-
<IntlProvider locale="en">
|
|
218
|
-
<PageTab hide>
|
|
219
|
-
<TabLink to="/Foo/modu">
|
|
220
|
-
<TabText>A page</TabText>
|
|
221
|
-
<CloseIcon onClick={close} />
|
|
222
|
-
</TabLink>
|
|
223
|
-
</PageTab>
|
|
224
|
-
</IntlProvider>
|
|
225
|
-
</Router>,
|
|
226
|
-
).then(() => expect(close, "was called")));
|
|
227
|
-
|
|
228
|
-
it("renders a tab outside the current scope", () =>
|
|
229
|
-
expect(
|
|
230
|
-
<Provider
|
|
231
|
-
store={{
|
|
232
|
-
subscribe: () => {},
|
|
233
|
-
dispatch: () => {},
|
|
234
|
-
getState: () => ({}),
|
|
235
|
-
}}
|
|
236
|
-
>
|
|
237
|
-
<Router history={history}>
|
|
238
|
-
<IntlProvider locale="en">
|
|
239
|
-
<Tab
|
|
240
|
-
module
|
|
241
|
-
outsideScope
|
|
242
|
-
icon="test"
|
|
243
|
-
label={{ id: "test.module", defaultMessage: "A module" }}
|
|
244
|
-
href="/Foo/modu"
|
|
245
|
-
/>
|
|
246
|
-
</IntlProvider>
|
|
247
|
-
</Router>
|
|
248
|
-
</Provider>,
|
|
249
|
-
"when mounted",
|
|
250
|
-
"with event",
|
|
251
|
-
{
|
|
252
|
-
type: "click",
|
|
253
|
-
target: getClassSelector(
|
|
254
|
-
<MemoryRouter>
|
|
255
|
-
<TabLink to="/" />
|
|
256
|
-
</MemoryRouter>,
|
|
257
|
-
),
|
|
258
|
-
},
|
|
259
|
-
"to satisfy",
|
|
260
|
-
<Router history={history}>
|
|
261
|
-
<IntlProvider locale="en">
|
|
262
|
-
<ModuleTab outsideScope>
|
|
263
|
-
<TabLink outsideScope to="/Foo/modu">
|
|
264
|
-
<ModuleIcon id="test" />
|
|
265
|
-
<TabText>A module</TabText>
|
|
266
|
-
</TabLink>
|
|
267
|
-
</ModuleTab>
|
|
268
|
-
</IntlProvider>
|
|
269
|
-
</Router>,
|
|
270
|
-
));
|
|
271
|
-
|
|
272
|
-
it("renders a page tab with label and close button", () =>
|
|
273
|
-
expect(
|
|
274
|
-
<Provider
|
|
275
|
-
store={{
|
|
276
|
-
subscribe: () => {},
|
|
277
|
-
dispatch: () => {},
|
|
278
|
-
getState: () => ({}),
|
|
279
|
-
}}
|
|
280
|
-
>
|
|
281
|
-
<Router history={history}>
|
|
282
|
-
<IntlProvider locale="en">
|
|
283
|
-
<Tab label={{ id: "test.page", defaultMessage: "A page" }} href="/Foo/modu/page" close={close} />
|
|
284
|
-
</IntlProvider>
|
|
285
|
-
</Router>
|
|
286
|
-
</Provider>,
|
|
287
|
-
"when mounted",
|
|
288
|
-
"to satisfy",
|
|
289
|
-
<Router history={history}>
|
|
290
|
-
<IntlProvider locale="en">
|
|
291
|
-
<PageTab>
|
|
292
|
-
<TabLink to="/Foo/modu/page">
|
|
293
|
-
<TabText>A page</TabText>
|
|
294
|
-
<CloseIcon onClick={close} />
|
|
295
|
-
</TabLink>
|
|
296
|
-
</PageTab>
|
|
297
|
-
</IntlProvider>
|
|
298
|
-
</Router>,
|
|
299
|
-
));
|
|
300
|
-
|
|
301
|
-
it("renders an active page tab", () =>
|
|
302
|
-
expect(
|
|
303
|
-
<Provider
|
|
304
|
-
store={{
|
|
305
|
-
subscribe: () => {},
|
|
306
|
-
dispatch: () => {},
|
|
307
|
-
getState: () => ({}),
|
|
308
|
-
}}
|
|
309
|
-
>
|
|
310
|
-
<Router history={history}>
|
|
311
|
-
<IntlProvider locale="en">
|
|
312
|
-
<Tab active href="/Foo/modu/page" />
|
|
313
|
-
</IntlProvider>
|
|
314
|
-
</Router>
|
|
315
|
-
</Provider>,
|
|
316
|
-
"when mounted",
|
|
317
|
-
"with event",
|
|
318
|
-
{
|
|
319
|
-
type: "click",
|
|
320
|
-
target: getClassSelector(<CloseIcon />),
|
|
321
|
-
},
|
|
322
|
-
"to satisfy",
|
|
323
|
-
<Router history={history}>
|
|
324
|
-
<IntlProvider locale="en">
|
|
325
|
-
<PageTab active>
|
|
326
|
-
<TabLink to="/Foo/modu/page">
|
|
327
|
-
<TabText>
|
|
328
|
-
<Ignore />
|
|
329
|
-
</TabText>
|
|
330
|
-
<CloseIcon onClick={expect.it("to be a function")} />
|
|
331
|
-
</TabLink>
|
|
332
|
-
</PageTab>
|
|
333
|
-
</IntlProvider>
|
|
334
|
-
</Router>,
|
|
335
|
-
));
|
|
336
|
-
|
|
337
|
-
it("curries close handler with tab and mapped href", () =>
|
|
338
|
-
expect(
|
|
339
|
-
<Provider
|
|
340
|
-
store={{
|
|
341
|
-
subscribe: () => {},
|
|
342
|
-
dispatch: () => {},
|
|
343
|
-
getState: () => ({}),
|
|
344
|
-
}}
|
|
345
|
-
>
|
|
346
|
-
<Router history={history}>
|
|
347
|
-
<IntlProvider locale="en">
|
|
348
|
-
<Tab label="A page" href="/Foo/modu/page/sub" mappedFrom="/Foo/modu/page" close={close} />
|
|
349
|
-
</IntlProvider>
|
|
350
|
-
</Router>
|
|
351
|
-
</Provider>,
|
|
352
|
-
"when mounted",
|
|
353
|
-
"with event",
|
|
354
|
-
{
|
|
355
|
-
type: "click",
|
|
356
|
-
target: getClassSelector(<CloseIcon />),
|
|
357
|
-
},
|
|
358
|
-
).then(() => expect(close, "was called")));
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
describe("TabText", () => {
|
|
362
|
-
let history;
|
|
363
|
-
beforeEach(() => {
|
|
364
|
-
history = createMemoryHistory();
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
it("sets css for TabLink without attributes", () =>
|
|
368
|
-
expect(
|
|
369
|
-
<Provider
|
|
370
|
-
store={{
|
|
371
|
-
subscribe: () => {},
|
|
372
|
-
dispatch: () => {},
|
|
373
|
-
getState: () => ({}),
|
|
374
|
-
}}
|
|
375
|
-
>
|
|
376
|
-
<Router history={history}>
|
|
377
|
-
<TabLink to="/" />
|
|
378
|
-
</Router>
|
|
379
|
-
</Provider>,
|
|
380
|
-
"when mounted",
|
|
381
|
-
"to have style rules satisfying",
|
|
382
|
-
expect.it("not to contain", "cursor: not-allowed;").and("not to contain", "max-width: 220px;"),
|
|
383
|
-
));
|
|
384
|
-
|
|
385
|
-
it("sets css for TabLink with attributes", () =>
|
|
386
|
-
expect(
|
|
387
|
-
<Provider
|
|
388
|
-
store={{
|
|
389
|
-
subscribe: () => {},
|
|
390
|
-
dispatch: () => {},
|
|
391
|
-
getState: () => ({}),
|
|
392
|
-
}}
|
|
393
|
-
>
|
|
394
|
-
<Router history={history}>
|
|
395
|
-
<TabLink to="/" outsideScope={true} mustTruncate={true} />
|
|
396
|
-
</Router>
|
|
397
|
-
</Provider>,
|
|
398
|
-
"when mounted",
|
|
399
|
-
"to have style rules satisfying",
|
|
400
|
-
"to contain",
|
|
401
|
-
"cursor: not-allowed;",
|
|
402
|
-
"max-width: 220px;",
|
|
403
|
-
));
|
|
404
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import pt from "prop-types";
|
|
3
|
-
import styled, { css, keyframes } from "styled-components";
|
|
4
|
-
import Text, { ptLabel } from "./Text";
|
|
5
|
-
import Icon from "./Icon";
|
|
6
|
-
import { ifFlag } from "../utils";
|
|
7
|
-
|
|
8
|
-
const rotate = keyframes`
|
|
9
|
-
to { transform: rotate(1turn); }
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export const PlaceholderBox = styled.div`
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: center;
|
|
16
|
-
margin: auto;
|
|
17
|
-
${ifFlag("warn", "color: #ed2e0b; width: 33%; max-width:540px; text-align:center;", "color: #ababab;")}
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
export const PlaceholderIcon = styled(Icon)`
|
|
21
|
-
font-size: 140px;
|
|
22
|
-
|
|
23
|
-
${ifFlag(
|
|
24
|
-
"animate",
|
|
25
|
-
css`
|
|
26
|
-
animation: ${rotate} 4s linear infinite;
|
|
27
|
-
`,
|
|
28
|
-
)};
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
export const PlaceholderTitle = styled.div`
|
|
32
|
-
margin-top: 5px;
|
|
33
|
-
font-size: 2em;
|
|
34
|
-
`;
|
|
35
|
-
export const PlaceholderSubtitle = styled.div`
|
|
36
|
-
font-size: 1.3em;
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
const Placeholder = ({ icon, title, subtitle, animate, warn, ...props }) => (
|
|
40
|
-
<PlaceholderBox warn={warn} {...props}>
|
|
41
|
-
{icon ? <PlaceholderIcon id={icon} animate={animate} /> : null}
|
|
42
|
-
{title ? (
|
|
43
|
-
<PlaceholderTitle>
|
|
44
|
-
<Text message={title} />
|
|
45
|
-
</PlaceholderTitle>
|
|
46
|
-
) : null}
|
|
47
|
-
{subtitle ? (
|
|
48
|
-
<PlaceholderSubtitle>
|
|
49
|
-
<Text message={subtitle} />
|
|
50
|
-
</PlaceholderSubtitle>
|
|
51
|
-
) : null}
|
|
52
|
-
</PlaceholderBox>
|
|
53
|
-
);
|
|
54
|
-
Placeholder.propTypes = {
|
|
55
|
-
icon: pt.string,
|
|
56
|
-
title: ptLabel,
|
|
57
|
-
subtitle: ptLabel,
|
|
58
|
-
animate: pt.bool,
|
|
59
|
-
warn: pt.bool,
|
|
60
|
-
};
|
|
61
|
-
export default Placeholder;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Provider } from "react-redux";
|
|
3
|
-
import { IntlProvider } from "react-intl";
|
|
4
|
-
import { spyOnConsole } from "../utils/testUtils";
|
|
5
|
-
import Placeholder, { PlaceholderBox, PlaceholderIcon, PlaceholderTitle, PlaceholderSubtitle } from "./Placeholder";
|
|
6
|
-
|
|
7
|
-
describe("Placeholder", () => {
|
|
8
|
-
spyOnConsole();
|
|
9
|
-
it("renders a placeholder with icon, title, and subtitle", () =>
|
|
10
|
-
expect(
|
|
11
|
-
<Provider
|
|
12
|
-
store={{
|
|
13
|
-
subscribe: () => {},
|
|
14
|
-
dispatch: () => {},
|
|
15
|
-
getState: () => ({}),
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<Placeholder icon="testIcon" title="A title" subtitle="A subtitle" otherProp={true} />
|
|
19
|
-
</Provider>,
|
|
20
|
-
"when mounted",
|
|
21
|
-
"to satisfy",
|
|
22
|
-
<PlaceholderBox otherProp={true}>
|
|
23
|
-
<PlaceholderIcon id="testIcon" />
|
|
24
|
-
<PlaceholderTitle>A title</PlaceholderTitle>
|
|
25
|
-
<PlaceholderSubtitle>A subtitle</PlaceholderSubtitle>
|
|
26
|
-
</PlaceholderBox>,
|
|
27
|
-
).then(() => expect(console.error, "was not called")));
|
|
28
|
-
|
|
29
|
-
it("renders an empty placeholder", () =>
|
|
30
|
-
expect(<Placeholder />, "when mounted", "to satisfy", <PlaceholderBox />).then(() =>
|
|
31
|
-
expect(console.error, "was not called"),
|
|
32
|
-
));
|
|
33
|
-
|
|
34
|
-
it("renders an animated icon", () =>
|
|
35
|
-
expect(
|
|
36
|
-
<Placeholder icon="testIcon" animate />,
|
|
37
|
-
"when mounted",
|
|
38
|
-
"to satisfy",
|
|
39
|
-
<PlaceholderBox>
|
|
40
|
-
<PlaceholderIcon id="testIcon" animate />
|
|
41
|
-
</PlaceholderBox>,
|
|
42
|
-
).then(() => expect(console.error, "was not called")));
|
|
43
|
-
|
|
44
|
-
it("translates title and subtitle if given message descriptors", () =>
|
|
45
|
-
expect(
|
|
46
|
-
<Provider
|
|
47
|
-
store={{
|
|
48
|
-
subscribe: () => {},
|
|
49
|
-
dispatch: () => {},
|
|
50
|
-
getState: () => ({}),
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<IntlProvider
|
|
54
|
-
locale="en"
|
|
55
|
-
messages={{
|
|
56
|
-
"test.title": "The title",
|
|
57
|
-
"test.subtitle": "The subtitle",
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
<Placeholder
|
|
61
|
-
title={{ id: "test.title", defaultMessage: "A default title" }}
|
|
62
|
-
subtitle={{
|
|
63
|
-
id: "test.subtitle",
|
|
64
|
-
defaultMessage: "A default subtitle",
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
</IntlProvider>
|
|
68
|
-
</Provider>,
|
|
69
|
-
"when mounted",
|
|
70
|
-
"to satisfy",
|
|
71
|
-
<PlaceholderBox>
|
|
72
|
-
<PlaceholderTitle>The title</PlaceholderTitle>
|
|
73
|
-
<PlaceholderSubtitle>The subtitle</PlaceholderSubtitle>
|
|
74
|
-
</PlaceholderBox>,
|
|
75
|
-
).then(() => expect(console.error, "was not called")));
|
|
76
|
-
|
|
77
|
-
it("renders a warning placeholder", () =>
|
|
78
|
-
expect(
|
|
79
|
-
<Placeholder icon="testIcon" warn />,
|
|
80
|
-
"when mounted",
|
|
81
|
-
"to satisfy",
|
|
82
|
-
<PlaceholderBox warn>
|
|
83
|
-
<PlaceholderIcon id="testIcon" />
|
|
84
|
-
</PlaceholderBox>,
|
|
85
|
-
).then(() => expect(console.error, "was not called")));
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe("PlaceholderIcon", () => {
|
|
89
|
-
it("renders with animation", () =>
|
|
90
|
-
expect(
|
|
91
|
-
<PlaceholderIcon id="spinner" animate />,
|
|
92
|
-
"when mounted",
|
|
93
|
-
"to have style rules satisfying",
|
|
94
|
-
"to contain",
|
|
95
|
-
"animation: ",
|
|
96
|
-
));
|
|
97
|
-
|
|
98
|
-
it("renders without animation", () =>
|
|
99
|
-
expect(
|
|
100
|
-
<PlaceholderIcon id="spinner" />,
|
|
101
|
-
"when mounted",
|
|
102
|
-
"to have style rules satisfying",
|
|
103
|
-
"not to contain",
|
|
104
|
-
"animation: ",
|
|
105
|
-
));
|
|
106
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { getThemeProp } from "../../utils";
|
|
4
|
-
import Input from "../Input";
|
|
5
|
-
import Treeview from "../Treeview";
|
|
6
|
-
import ScopeNode from "./ScopeNode";
|
|
7
|
-
import Sidepanel from "../Sidepanel";
|
|
8
|
-
import withClickOutside from "../../hocs/withClickOutside";
|
|
9
|
-
import { useIntl } from "react-intl";
|
|
10
|
-
import sharedMessages from "./../../sharedMessages";
|
|
11
|
-
|
|
12
|
-
export const Wrapper = withClickOutside(styled.div`
|
|
13
|
-
height: 100%;
|
|
14
|
-
width: 100%;
|
|
15
|
-
user-select: none;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
`);
|
|
19
|
-
|
|
20
|
-
export const InputBox = styled.div`
|
|
21
|
-
border-bottom: 1px solid #666;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const SearchInput = styled(Input)`
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
border-color: ${getThemeProp(["colors", "border"], "#999999")};
|
|
27
|
-
color: ${getThemeProp(["colors", "textMedium"], "#999999")};
|
|
28
|
-
width: calc(100% - 40px);
|
|
29
|
-
margin: 20px;
|
|
30
|
-
font-size: 14px;
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
export const SelectorPanel = styled(Sidepanel)`
|
|
34
|
-
top: 90px;
|
|
35
|
-
background-color: ${getThemeProp(["colors", "bgDark"], "#333333")};
|
|
36
|
-
color: #fff;
|
|
37
|
-
z-index: 1000;
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
export const Selector = ({ name, show, reset, getScope, currentScope, defaultNodeState, filter, updateFilter }) => {
|
|
41
|
-
const { formatMessage } = useIntl();
|
|
42
|
-
return (
|
|
43
|
-
<SelectorPanel in={show} width="27vw" timeout={300}>
|
|
44
|
-
<Wrapper onClickOutside={reset}>
|
|
45
|
-
<InputBox>
|
|
46
|
-
<SearchInput
|
|
47
|
-
placeholder={formatMessage(sharedMessages.scopeFilterPlaceholder)}
|
|
48
|
-
value={filter}
|
|
49
|
-
onChange={updateFilter}
|
|
50
|
-
/>
|
|
51
|
-
</InputBox>
|
|
52
|
-
<Treeview
|
|
53
|
-
{...{
|
|
54
|
-
name,
|
|
55
|
-
Content: ScopeNode,
|
|
56
|
-
rootId: "Global",
|
|
57
|
-
getNode: getScope,
|
|
58
|
-
selectedNodeId: (currentScope && currentScope.id) || null,
|
|
59
|
-
openAll: !!filter,
|
|
60
|
-
closeSelector: reset,
|
|
61
|
-
dark: true,
|
|
62
|
-
defaultNodeState,
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
</Wrapper>
|
|
66
|
-
</SelectorPanel>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default Selector;
|