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
|
@@ -6,10 +6,9 @@ import Immutable from "immutable";
|
|
|
6
6
|
import { mount } from "enzyme";
|
|
7
7
|
import sinon from "sinon";
|
|
8
8
|
import { spyOnConsole } from "../../utils/testUtils";
|
|
9
|
-
import { REMOVE_TAB } from "../../actions/navigation";
|
|
10
9
|
import { resetLastScope } from "../../selectors/navigation";
|
|
11
10
|
import useNavigationState, { getPageData } from "./useNavigationState";
|
|
12
|
-
import
|
|
11
|
+
import TabBar from "../MaterialUI/Navigation/TabBar";
|
|
13
12
|
import { PropStruct } from "../../utils/testUtils";
|
|
14
13
|
import { cloneDeep } from "lodash";
|
|
15
14
|
|
|
@@ -107,6 +106,8 @@ describe("useNavigationState", () => {
|
|
|
107
106
|
},
|
|
108
107
|
"test/notexist": {
|
|
109
108
|
href: "/TestScope/test/notexist",
|
|
109
|
+
path: "/:scope/notexist",
|
|
110
|
+
params: { scope: "TestScope" },
|
|
110
111
|
},
|
|
111
112
|
},
|
|
112
113
|
moduleTabs: {
|
|
@@ -158,6 +159,14 @@ describe("useNavigationState", () => {
|
|
|
158
159
|
settings: {
|
|
159
160
|
defaultScope: "myScope",
|
|
160
161
|
},
|
|
162
|
+
modules: {
|
|
163
|
+
tree: {},
|
|
164
|
+
},
|
|
165
|
+
view: {
|
|
166
|
+
edit: {
|
|
167
|
+
test: {},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
161
170
|
});
|
|
162
171
|
store = {
|
|
163
172
|
subscribe: () => {},
|
|
@@ -189,6 +198,7 @@ describe("useNavigationState", () => {
|
|
|
189
198
|
},
|
|
190
199
|
},
|
|
191
200
|
};
|
|
201
|
+
|
|
192
202
|
modulesWithSelector = {
|
|
193
203
|
test: {
|
|
194
204
|
icon: "thing",
|
|
@@ -215,7 +225,7 @@ describe("useNavigationState", () => {
|
|
|
215
225
|
},
|
|
216
226
|
},
|
|
217
227
|
};
|
|
218
|
-
TestBar = makeTestComp(
|
|
228
|
+
TestBar = makeTestComp(TabBar);
|
|
219
229
|
TestProps = makeTestComp(PropStruct);
|
|
220
230
|
});
|
|
221
231
|
afterEach(() => {
|
|
@@ -240,7 +250,7 @@ describe("useNavigationState", () => {
|
|
|
240
250
|
<Provider store={store}>
|
|
241
251
|
<IntlProvider locale="en">
|
|
242
252
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
243
|
-
<
|
|
253
|
+
<TabBar
|
|
244
254
|
module={{
|
|
245
255
|
icon: "thing",
|
|
246
256
|
label: "Thing",
|
|
@@ -281,7 +291,7 @@ describe("useNavigationState", () => {
|
|
|
281
291
|
<Provider store={store}>
|
|
282
292
|
<IntlProvider locale="en">
|
|
283
293
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
284
|
-
<
|
|
294
|
+
<TabBar
|
|
285
295
|
module={{
|
|
286
296
|
icon: "thing",
|
|
287
297
|
label: "Thing",
|
|
@@ -295,10 +305,10 @@ describe("useNavigationState", () => {
|
|
|
295
305
|
href: "/TestScope/test/page1",
|
|
296
306
|
mappedFrom: "/TestScope/test/page1",
|
|
297
307
|
active: true,
|
|
298
|
-
params: "__ignore",
|
|
299
308
|
path: "__ignore",
|
|
300
309
|
outsideScope: false,
|
|
301
310
|
scopeNotSupported: false,
|
|
311
|
+
params: { scope: "TestScope", entityId: "page1" },
|
|
302
312
|
},
|
|
303
313
|
{
|
|
304
314
|
label: {
|
|
@@ -311,11 +321,11 @@ describe("useNavigationState", () => {
|
|
|
311
321
|
href: "/OtherScope/test/foo",
|
|
312
322
|
mappedFrom: "/OtherScope/test/foo",
|
|
313
323
|
active: false,
|
|
314
|
-
params: "__ignore",
|
|
315
324
|
path: "__ignore",
|
|
316
325
|
mustTruncate: true,
|
|
317
326
|
outsideScope: true,
|
|
318
327
|
scopeNotSupported: false,
|
|
328
|
+
params: { scope: "OtherScope", entityId: "foo" },
|
|
319
329
|
},
|
|
320
330
|
{
|
|
321
331
|
label: {
|
|
@@ -328,11 +338,11 @@ describe("useNavigationState", () => {
|
|
|
328
338
|
href: "/OtherScope/test/bar",
|
|
329
339
|
mappedFrom: "/OtherScope/test/bar",
|
|
330
340
|
active: false,
|
|
331
|
-
params: "__ignore",
|
|
332
341
|
path: "__ignore",
|
|
333
342
|
mustTruncate: true,
|
|
334
343
|
outsideScope: true,
|
|
335
344
|
scopeNotSupported: false,
|
|
345
|
+
params: { scope: "OtherScope", entityId: "bar" },
|
|
336
346
|
},
|
|
337
347
|
{
|
|
338
348
|
label: {
|
|
@@ -343,16 +353,18 @@ describe("useNavigationState", () => {
|
|
|
343
353
|
href: "/TestScope/test/page3",
|
|
344
354
|
mappedFrom: "/TestScope/test/page3",
|
|
345
355
|
active: false,
|
|
346
|
-
params: "__ignore",
|
|
347
356
|
path: "__ignore",
|
|
348
357
|
outsideScope: false,
|
|
349
358
|
scopeNotSupported: false,
|
|
359
|
+
params: { scope: "TestScope", entityId: "page3" },
|
|
350
360
|
},
|
|
351
361
|
{
|
|
352
362
|
href: "/TestScope/test/notexist",
|
|
353
363
|
mappedFrom: "/TestScope/test/notexist",
|
|
354
364
|
label: "[Not found]",
|
|
365
|
+
path: "__ignore",
|
|
355
366
|
active: false,
|
|
367
|
+
params: { scope: "TestScope", entityId: "notexist" },
|
|
356
368
|
},
|
|
357
369
|
]}
|
|
358
370
|
moduleName="test"
|
|
@@ -386,7 +398,7 @@ describe("useNavigationState", () => {
|
|
|
386
398
|
<Provider store={store}>
|
|
387
399
|
<IntlProvider locale="en">
|
|
388
400
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
389
|
-
<
|
|
401
|
+
<TabBar
|
|
390
402
|
module={{
|
|
391
403
|
icon: "thing",
|
|
392
404
|
label: "Thing",
|
|
@@ -400,10 +412,10 @@ describe("useNavigationState", () => {
|
|
|
400
412
|
href: "/TestScope/test/page1",
|
|
401
413
|
mappedFrom: "/TestScope/test/page1",
|
|
402
414
|
active: true,
|
|
403
|
-
params: "__ignore",
|
|
404
415
|
path: "__ignore",
|
|
405
416
|
outsideScope: false,
|
|
406
417
|
scopeNotSupported: false,
|
|
418
|
+
params: { scope: "TestScope", entityId: "page1" },
|
|
407
419
|
},
|
|
408
420
|
{
|
|
409
421
|
label: {
|
|
@@ -416,11 +428,11 @@ describe("useNavigationState", () => {
|
|
|
416
428
|
href: "/TestScope/test/foo",
|
|
417
429
|
mappedFrom: "/TestScope/test/foo",
|
|
418
430
|
active: false,
|
|
419
|
-
params: "__ignore",
|
|
420
431
|
path: "__ignore",
|
|
421
432
|
mustTruncate: true,
|
|
422
433
|
outsideScope: true,
|
|
423
434
|
scopeNotSupported: true,
|
|
435
|
+
params: { scope: "TestScope", entityId: "foo" },
|
|
424
436
|
},
|
|
425
437
|
{
|
|
426
438
|
label: {
|
|
@@ -433,11 +445,11 @@ describe("useNavigationState", () => {
|
|
|
433
445
|
href: "/TestScope/test/bar",
|
|
434
446
|
mappedFrom: "/TestScope/test/bar",
|
|
435
447
|
active: false,
|
|
436
|
-
params: "__ignore",
|
|
437
448
|
path: "__ignore",
|
|
438
449
|
mustTruncate: true,
|
|
439
450
|
outsideScope: true,
|
|
440
451
|
scopeNotSupported: true,
|
|
452
|
+
params: { scope: "TestScope", entityId: "bar" },
|
|
441
453
|
},
|
|
442
454
|
{
|
|
443
455
|
label: {
|
|
@@ -448,16 +460,18 @@ describe("useNavigationState", () => {
|
|
|
448
460
|
href: "/TestScope/test/page3",
|
|
449
461
|
mappedFrom: "/TestScope/test/page3",
|
|
450
462
|
active: false,
|
|
451
|
-
params: "__ignore",
|
|
452
463
|
path: "__ignore",
|
|
453
464
|
outsideScope: false,
|
|
454
465
|
scopeNotSupported: false,
|
|
466
|
+
params: { scope: "TestScope", entityId: "page3" },
|
|
455
467
|
},
|
|
456
468
|
{
|
|
457
469
|
href: "/TestScope/test/notexist",
|
|
458
470
|
mappedFrom: "/TestScope/test/notexist",
|
|
459
471
|
label: "[Not found]",
|
|
472
|
+
path: "__ignore",
|
|
460
473
|
active: false,
|
|
474
|
+
params: { scope: "TestScope", entityId: "notexist" },
|
|
461
475
|
},
|
|
462
476
|
]}
|
|
463
477
|
moduleName="test"
|
|
@@ -499,7 +513,7 @@ describe("useNavigationState", () => {
|
|
|
499
513
|
<Provider store={storeWithEmptyScopes}>
|
|
500
514
|
<IntlProvider locale="en">
|
|
501
515
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
502
|
-
<
|
|
516
|
+
<TabBar
|
|
503
517
|
module={{
|
|
504
518
|
icon: "thing",
|
|
505
519
|
label: "Thing",
|
|
@@ -513,10 +527,10 @@ describe("useNavigationState", () => {
|
|
|
513
527
|
href: "/TestScope/test/page1",
|
|
514
528
|
mappedFrom: "/TestScope/test/page1",
|
|
515
529
|
active: true,
|
|
516
|
-
params: "__ignore",
|
|
517
530
|
path: "__ignore",
|
|
518
531
|
outsideScope: false,
|
|
519
532
|
scopeNotSupported: false,
|
|
533
|
+
params: { scope: "TestScope", entityId: "page1" },
|
|
520
534
|
},
|
|
521
535
|
{
|
|
522
536
|
label: {
|
|
@@ -529,11 +543,11 @@ describe("useNavigationState", () => {
|
|
|
529
543
|
href: "/TestScope/test/foo",
|
|
530
544
|
mappedFrom: "/TestScope/test/foo",
|
|
531
545
|
active: false,
|
|
532
|
-
params: "__ignore",
|
|
533
546
|
path: "__ignore",
|
|
534
547
|
mustTruncate: true,
|
|
535
548
|
outsideScope: true,
|
|
536
549
|
scopeNotSupported: true,
|
|
550
|
+
params: { scope: "TestScope", entityId: "foo" },
|
|
537
551
|
},
|
|
538
552
|
{
|
|
539
553
|
label: {
|
|
@@ -546,11 +560,11 @@ describe("useNavigationState", () => {
|
|
|
546
560
|
href: "/TestScope/test/bar",
|
|
547
561
|
mappedFrom: "/TestScope/test/bar",
|
|
548
562
|
active: false,
|
|
549
|
-
params: "__ignore",
|
|
550
563
|
path: "__ignore",
|
|
551
564
|
mustTruncate: true,
|
|
552
565
|
outsideScope: true,
|
|
553
566
|
scopeNotSupported: true,
|
|
567
|
+
params: { scope: "TestScope", entityId: "bar" },
|
|
554
568
|
},
|
|
555
569
|
{
|
|
556
570
|
label: {
|
|
@@ -561,16 +575,18 @@ describe("useNavigationState", () => {
|
|
|
561
575
|
href: "/TestScope/test/page3",
|
|
562
576
|
mappedFrom: "/TestScope/test/page3",
|
|
563
577
|
active: false,
|
|
564
|
-
params: "__ignore",
|
|
565
578
|
path: "__ignore",
|
|
566
579
|
outsideScope: false,
|
|
567
580
|
scopeNotSupported: false,
|
|
581
|
+
params: { scope: "TestScope", entityId: "page3" },
|
|
568
582
|
},
|
|
569
583
|
{
|
|
570
584
|
href: "/TestScope/test/notexist",
|
|
571
585
|
mappedFrom: "/TestScope/test/notexist",
|
|
572
586
|
label: "[Not found]",
|
|
587
|
+
path: "__ignore",
|
|
573
588
|
active: false,
|
|
589
|
+
params: { scope: "TestScope", entityId: "notexist" },
|
|
574
590
|
},
|
|
575
591
|
]}
|
|
576
592
|
moduleName="test"
|
|
@@ -626,11 +642,11 @@ describe("useNavigationState", () => {
|
|
|
626
642
|
tabIndex: {
|
|
627
643
|
test: {
|
|
628
644
|
href: "/TestScope/test",
|
|
629
|
-
params: { scope: "
|
|
645
|
+
params: { scope: "page1", entityId: "page1" },
|
|
630
646
|
},
|
|
631
647
|
"test/page2": {
|
|
632
648
|
href: "/TestScope/test/page2",
|
|
633
|
-
params: { scope: "
|
|
649
|
+
params: { scope: "page2", entityId: "page2" },
|
|
634
650
|
},
|
|
635
651
|
},
|
|
636
652
|
mappedHrefs: {
|
|
@@ -641,7 +657,7 @@ describe("useNavigationState", () => {
|
|
|
641
657
|
match: {
|
|
642
658
|
url: "/TestScope/test/page1",
|
|
643
659
|
path: "/:scope/test/page1",
|
|
644
|
-
params: { scope: "
|
|
660
|
+
params: { scope: "page2", entityId: "page2" },
|
|
645
661
|
},
|
|
646
662
|
},
|
|
647
663
|
config: { prependPath: "/:scope/", prependHref: "/TestScope/" },
|
|
@@ -672,6 +688,11 @@ describe("useNavigationState", () => {
|
|
|
672
688
|
settings: {
|
|
673
689
|
defaultScope: "myScope",
|
|
674
690
|
},
|
|
691
|
+
view: {
|
|
692
|
+
edit: {
|
|
693
|
+
test: {},
|
|
694
|
+
},
|
|
695
|
+
},
|
|
675
696
|
});
|
|
676
697
|
modules = {
|
|
677
698
|
test: {
|
|
@@ -722,8 +743,8 @@ describe("useNavigationState", () => {
|
|
|
722
743
|
active: false,
|
|
723
744
|
outsideScope: false,
|
|
724
745
|
scopeNotSupported: false,
|
|
725
|
-
params: "__ignore",
|
|
726
746
|
close: () => {},
|
|
747
|
+
params: { scope: "page2", entityId: "page2" },
|
|
727
748
|
},
|
|
728
749
|
]}
|
|
729
750
|
moduleName="test"
|
|
@@ -794,10 +815,16 @@ describe("useNavigationState", () => {
|
|
|
794
815
|
settings: {
|
|
795
816
|
defaultScope: "myScope",
|
|
796
817
|
},
|
|
818
|
+
view: {
|
|
819
|
+
edit: {
|
|
820
|
+
test: {},
|
|
821
|
+
},
|
|
822
|
+
},
|
|
797
823
|
});
|
|
798
824
|
page = {
|
|
799
825
|
label: { id: "page", defaultMessage: "Page {someField}" },
|
|
800
826
|
component: TestComp1,
|
|
827
|
+
params: { scope: "TestScope", entityId: "page" },
|
|
801
828
|
};
|
|
802
829
|
modules = page => ({
|
|
803
830
|
test: {
|
|
@@ -830,7 +857,7 @@ describe("useNavigationState", () => {
|
|
|
830
857
|
<Provider store={store}>
|
|
831
858
|
<IntlProvider locale="en">
|
|
832
859
|
<MemoryRouter initialEntries={["/TestScope/test/foo"]}>
|
|
833
|
-
<
|
|
860
|
+
<TabBar
|
|
834
861
|
module={{
|
|
835
862
|
icon: "thing",
|
|
836
863
|
label: "Thing",
|
|
@@ -892,7 +919,7 @@ describe("useNavigationState", () => {
|
|
|
892
919
|
<Provider store={store}>
|
|
893
920
|
<IntlProvider locale="en">
|
|
894
921
|
<MemoryRouter initialEntries={["/TestScope/test/foo"]}>
|
|
895
|
-
<
|
|
922
|
+
<TabBar
|
|
896
923
|
module={{
|
|
897
924
|
icon: "thing",
|
|
898
925
|
label: "Thing",
|
|
@@ -951,7 +978,7 @@ describe("useNavigationState", () => {
|
|
|
951
978
|
<Provider store={store}>
|
|
952
979
|
<IntlProvider locale="en">
|
|
953
980
|
<MemoryRouter initialEntries={["/TestScope/test/foo"]}>
|
|
954
|
-
<
|
|
981
|
+
<TabBar
|
|
955
982
|
module={{
|
|
956
983
|
icon: "thing",
|
|
957
984
|
label: "Thing",
|
|
@@ -1008,252 +1035,84 @@ describe("useNavigationState", () => {
|
|
|
1008
1035
|
});
|
|
1009
1036
|
});
|
|
1010
1037
|
|
|
1011
|
-
it("
|
|
1012
|
-
const fakeEvent = {
|
|
1013
|
-
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1014
|
-
preventDefault: sinon.spy().named("preventDefault"),
|
|
1015
|
-
};
|
|
1016
|
-
return expect(
|
|
1017
|
-
<Provider store={store}>
|
|
1018
|
-
<IntlProvider locale="en">
|
|
1019
|
-
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
1020
|
-
<TestBar modules={modules} />
|
|
1021
|
-
</MemoryRouter>
|
|
1022
|
-
</IntlProvider>
|
|
1023
|
-
</Provider>,
|
|
1024
|
-
"when mounted",
|
|
1025
|
-
"with event",
|
|
1026
|
-
{
|
|
1027
|
-
type: "click",
|
|
1028
|
-
target: '[data-href="/TestScope/test/page3"] svg',
|
|
1029
|
-
data: fakeEvent,
|
|
1030
|
-
},
|
|
1031
|
-
).then(() =>
|
|
1032
|
-
Promise.all([
|
|
1033
|
-
expect(store.dispatch, "to have calls satisfying", [
|
|
1034
|
-
{
|
|
1035
|
-
args: [
|
|
1036
|
-
{
|
|
1037
|
-
type: REMOVE_TAB,
|
|
1038
|
-
payload: { module: "test", path: "/TestScope/test/page3" },
|
|
1039
|
-
},
|
|
1040
|
-
],
|
|
1041
|
-
},
|
|
1042
|
-
]),
|
|
1043
|
-
expect(fakeEvent.stopPropagation, "was called once"),
|
|
1044
|
-
expect(fakeEvent.preventDefault, "was called once"),
|
|
1045
|
-
]),
|
|
1046
|
-
);
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
it("Tab closing handler is not invoked when entity selector returns invalid entity", () => {
|
|
1038
|
+
it("Ensure tab closing handler is invoked when explicitly closing a tab", () => {
|
|
1050
1039
|
const fakeEvent = {
|
|
1051
1040
|
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1052
1041
|
preventDefault: sinon.spy().named("preventDefault"),
|
|
1053
1042
|
};
|
|
1054
1043
|
|
|
1055
1044
|
const closingHandler = sinon.spy().named("closingHandler");
|
|
1056
|
-
const entitySelector = sinon.spy(() => ({ entityId: "entityId" })).named("entitySelector");
|
|
1045
|
+
const entitySelector = sinon.spy(() => ({ entityId: "entityId", entity: {} })).named("entitySelector");
|
|
1057
1046
|
|
|
1058
1047
|
modules.test.closingTabHandler = {
|
|
1059
1048
|
handler: closingHandler,
|
|
1060
1049
|
entitySelector: entitySelector,
|
|
1061
1050
|
};
|
|
1062
1051
|
|
|
1063
|
-
|
|
1052
|
+
const component = (
|
|
1064
1053
|
<Provider store={store}>
|
|
1065
1054
|
<IntlProvider locale="en">
|
|
1066
1055
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
1067
1056
|
<TestBar modules={modules} />
|
|
1068
1057
|
</MemoryRouter>
|
|
1069
1058
|
</IntlProvider>
|
|
1070
|
-
</Provider
|
|
1071
|
-
"when mounted",
|
|
1072
|
-
"with event",
|
|
1073
|
-
{
|
|
1074
|
-
type: "click",
|
|
1075
|
-
target: '[data-href="/TestScope/test/page3"] svg',
|
|
1076
|
-
data: fakeEvent,
|
|
1077
|
-
},
|
|
1078
|
-
).then(() =>
|
|
1079
|
-
Promise.all([
|
|
1080
|
-
expect(store.dispatch, "to have calls satisfying", [
|
|
1081
|
-
{
|
|
1082
|
-
args: [
|
|
1083
|
-
{
|
|
1084
|
-
type: REMOVE_TAB,
|
|
1085
|
-
payload: { module: "test", path: "/TestScope/test/page3" },
|
|
1086
|
-
},
|
|
1087
|
-
],
|
|
1088
|
-
},
|
|
1089
|
-
]),
|
|
1090
|
-
expect(fakeEvent.stopPropagation, "was called once"),
|
|
1091
|
-
expect(fakeEvent.preventDefault, "was called once"),
|
|
1092
|
-
expect(closingHandler, "was not called"),
|
|
1093
|
-
expect(entitySelector, "was called once"),
|
|
1094
|
-
]),
|
|
1059
|
+
</Provider>
|
|
1095
1060
|
);
|
|
1096
|
-
});
|
|
1097
1061
|
|
|
1098
|
-
|
|
1099
|
-
const fakeEvent = {
|
|
1100
|
-
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1101
|
-
preventDefault: sinon.spy().named("preventDefault"),
|
|
1102
|
-
};
|
|
1062
|
+
mount(component);
|
|
1103
1063
|
|
|
1104
|
-
|
|
1105
|
-
const entitySelector = sinon.spy(() => {}).named("entitySelector");
|
|
1064
|
+
expect(firstPagTabClose, "not to be null");
|
|
1106
1065
|
|
|
1107
|
-
|
|
1108
|
-
handler: closingHandler,
|
|
1109
|
-
entitySelector: entitySelector,
|
|
1110
|
-
};
|
|
1066
|
+
firstPagTabClose(null, true);
|
|
1111
1067
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
<TestBar modules={modules} />
|
|
1117
|
-
</MemoryRouter>
|
|
1118
|
-
</IntlProvider>
|
|
1119
|
-
</Provider>,
|
|
1120
|
-
"when mounted",
|
|
1121
|
-
"with event",
|
|
1122
|
-
{
|
|
1123
|
-
type: "click",
|
|
1124
|
-
target: '[data-href="/TestScope/test/page3"] svg',
|
|
1125
|
-
data: fakeEvent,
|
|
1126
|
-
},
|
|
1127
|
-
).then(() =>
|
|
1128
|
-
Promise.all([
|
|
1129
|
-
expect(store.dispatch, "to have calls satisfying", [
|
|
1130
|
-
{
|
|
1131
|
-
args: [
|
|
1132
|
-
{
|
|
1133
|
-
type: REMOVE_TAB,
|
|
1134
|
-
payload: { module: "test", path: "/TestScope/test/page3" },
|
|
1135
|
-
},
|
|
1136
|
-
],
|
|
1137
|
-
},
|
|
1138
|
-
]),
|
|
1139
|
-
expect(fakeEvent.stopPropagation, "was called once"),
|
|
1140
|
-
expect(fakeEvent.preventDefault, "was called once"),
|
|
1141
|
-
expect(closingHandler, "was not called"),
|
|
1142
|
-
expect(entitySelector, "was called once"),
|
|
1143
|
-
]),
|
|
1144
|
-
);
|
|
1068
|
+
expect(fakeEvent.stopPropagation, "was not called");
|
|
1069
|
+
expect(fakeEvent.preventDefault, "was not called");
|
|
1070
|
+
expect(closingHandler, "was called once");
|
|
1071
|
+
expect(entitySelector, "was called once");
|
|
1145
1072
|
});
|
|
1146
1073
|
|
|
1147
|
-
it("
|
|
1074
|
+
it("Ensure tab closing handler is invoked when explicitly closing a tab with an event", () => {
|
|
1148
1075
|
const fakeEvent = {
|
|
1149
1076
|
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1150
1077
|
preventDefault: sinon.spy().named("preventDefault"),
|
|
1151
1078
|
};
|
|
1152
1079
|
|
|
1153
1080
|
const closingHandler = sinon.spy().named("closingHandler");
|
|
1154
|
-
const entitySelector =
|
|
1081
|
+
const entitySelector = () => null;
|
|
1155
1082
|
|
|
1156
1083
|
modules.test.closingTabHandler = {
|
|
1157
1084
|
handler: closingHandler,
|
|
1158
1085
|
entitySelector: entitySelector,
|
|
1159
1086
|
};
|
|
1087
|
+
modules.test.pageScopeSelector = () => undefined;
|
|
1160
1088
|
|
|
1161
|
-
|
|
1089
|
+
const component = (
|
|
1162
1090
|
<Provider store={store}>
|
|
1163
1091
|
<IntlProvider locale="en">
|
|
1164
1092
|
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
1165
1093
|
<TestBar modules={modules} />
|
|
1166
1094
|
</MemoryRouter>
|
|
1167
1095
|
</IntlProvider>
|
|
1168
|
-
</Provider
|
|
1169
|
-
"when mounted",
|
|
1170
|
-
"with event",
|
|
1171
|
-
{
|
|
1172
|
-
type: "click",
|
|
1173
|
-
target: '[data-href="/TestScope/test/page3"] svg',
|
|
1174
|
-
data: fakeEvent,
|
|
1175
|
-
},
|
|
1176
|
-
).then(() =>
|
|
1177
|
-
Promise.all([
|
|
1178
|
-
expect(store.dispatch, "to have calls satisfying", [
|
|
1179
|
-
{
|
|
1180
|
-
args: [
|
|
1181
|
-
{
|
|
1182
|
-
type: REMOVE_TAB,
|
|
1183
|
-
payload: { module: "test", path: "/TestScope/test/page3" },
|
|
1184
|
-
},
|
|
1185
|
-
],
|
|
1186
|
-
},
|
|
1187
|
-
]),
|
|
1188
|
-
expect(fakeEvent.stopPropagation, "was called once"),
|
|
1189
|
-
expect(fakeEvent.preventDefault, "was called once"),
|
|
1190
|
-
expect(closingHandler, "was not called"),
|
|
1191
|
-
expect(entitySelector, "was called once"),
|
|
1192
|
-
]),
|
|
1096
|
+
</Provider>
|
|
1193
1097
|
);
|
|
1194
|
-
});
|
|
1195
1098
|
|
|
1196
|
-
|
|
1197
|
-
const fakeEvent = {
|
|
1198
|
-
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1199
|
-
preventDefault: sinon.spy().named("preventDefault"),
|
|
1200
|
-
};
|
|
1099
|
+
mount(component);
|
|
1201
1100
|
|
|
1202
|
-
|
|
1203
|
-
const entitySelector = sinon.spy(() => ({ entityId: "entityId", entity: {} })).named("entitySelector");
|
|
1101
|
+
expect(firstPagTabClose, "not to be null");
|
|
1204
1102
|
|
|
1205
|
-
|
|
1206
|
-
handler: closingHandler,
|
|
1207
|
-
entitySelector: entitySelector,
|
|
1208
|
-
};
|
|
1103
|
+
firstPagTabClose(fakeEvent);
|
|
1209
1104
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
<IntlProvider locale="en">
|
|
1213
|
-
<MemoryRouter initialEntries={["/TestScope/test/page1"]}>
|
|
1214
|
-
<TestBar modules={modules} />
|
|
1215
|
-
</MemoryRouter>
|
|
1216
|
-
</IntlProvider>
|
|
1217
|
-
</Provider>,
|
|
1218
|
-
"when mounted",
|
|
1219
|
-
"with event",
|
|
1220
|
-
{
|
|
1221
|
-
type: "click",
|
|
1222
|
-
target: '[data-href="/TestScope/test/page3"] svg',
|
|
1223
|
-
data: fakeEvent,
|
|
1224
|
-
},
|
|
1225
|
-
).then(() =>
|
|
1226
|
-
Promise.all([
|
|
1227
|
-
expect(store.dispatch, "to have calls satisfying", [
|
|
1228
|
-
{
|
|
1229
|
-
args: [
|
|
1230
|
-
{
|
|
1231
|
-
type: REMOVE_TAB,
|
|
1232
|
-
payload: { module: "test", path: "/TestScope/test/page3" },
|
|
1233
|
-
},
|
|
1234
|
-
],
|
|
1235
|
-
},
|
|
1236
|
-
]),
|
|
1237
|
-
expect(fakeEvent.stopPropagation, "was called once"),
|
|
1238
|
-
expect(fakeEvent.preventDefault, "was called once"),
|
|
1239
|
-
expect(entitySelector, "was called once"),
|
|
1240
|
-
expect(closingHandler, "was called once"),
|
|
1241
|
-
]),
|
|
1242
|
-
);
|
|
1105
|
+
expect(fakeEvent.stopPropagation, "was called");
|
|
1106
|
+
expect(fakeEvent.preventDefault, "was called");
|
|
1243
1107
|
});
|
|
1244
1108
|
|
|
1245
|
-
it("Ensure tab closing handler is invoked when explicitly closing a tab", () => {
|
|
1109
|
+
it("Ensure tab closing handler is invoked when explicitly closing a tab without a closing handler", () => {
|
|
1246
1110
|
const fakeEvent = {
|
|
1247
1111
|
stopPropagation: sinon.spy().named("stopPropagation"),
|
|
1248
1112
|
preventDefault: sinon.spy().named("preventDefault"),
|
|
1249
1113
|
};
|
|
1250
|
-
|
|
1251
|
-
const closingHandler = sinon.spy().named("closingHandler");
|
|
1252
|
-
const entitySelector = sinon.spy(() => ({ entityId: "entityId", entity: {} })).named("entitySelector");
|
|
1253
|
-
|
|
1254
1114
|
modules.test.closingTabHandler = {
|
|
1255
|
-
|
|
1256
|
-
entitySelector: entitySelector,
|
|
1115
|
+
entitySelector: () => null,
|
|
1257
1116
|
};
|
|
1258
1117
|
|
|
1259
1118
|
const component = (
|
|
@@ -1270,12 +1129,10 @@ describe("useNavigationState", () => {
|
|
|
1270
1129
|
|
|
1271
1130
|
expect(firstPagTabClose, "not to be null");
|
|
1272
1131
|
|
|
1273
|
-
firstPagTabClose(
|
|
1132
|
+
firstPagTabClose(fakeEvent);
|
|
1274
1133
|
|
|
1275
|
-
expect(fakeEvent.stopPropagation, "was
|
|
1276
|
-
expect(fakeEvent.preventDefault, "was
|
|
1277
|
-
expect(closingHandler, "was called once");
|
|
1278
|
-
expect(entitySelector, "was called once");
|
|
1134
|
+
expect(fakeEvent.stopPropagation, "was called");
|
|
1135
|
+
expect(fakeEvent.preventDefault, "was called");
|
|
1279
1136
|
});
|
|
1280
1137
|
});
|
|
1281
1138
|
describe("getPageData", () => {
|