orc-shared 1.7.0-dev.8 → 5.2.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/modules.js +15 -1
- package/dist/actions/navigation.js +1 -14
- package/dist/actions/scopes.js +2 -3
- package/dist/buildStore.js +1 -7
- package/dist/components/AppFrame/Sidebar.js +8 -4
- package/dist/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +6 -18
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -4
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +7 -7
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/dist/components/MaterialUI/Inputs/DatePicker.js +8 -15
- package/dist/components/MaterialUI/Inputs/InputBase.js +16 -102
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -7
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +46 -43
- package/dist/components/MaterialUI/Inputs/TimePicker.js +2 -5
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +1 -3
- package/dist/components/Routing/Page.js +1 -4
- package/dist/components/Routing/SegmentPage.js +1 -4
- package/dist/components/Routing/SubPage.js +8 -38
- package/dist/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/dist/constants.js +2 -18
- package/dist/content/icons/hide.svg +1 -10
- package/dist/content/icons/open-in-new-tab.svg +1 -3
- package/dist/content/iconsSheet.svg +650 -117
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/hooks/useEditState.js +2 -4
- package/dist/reducers/modules.js +3 -4
- package/dist/reducers/navigation.js +0 -16
- package/dist/reducers/request.js +1 -6
- package/dist/reducers/scopes.js +0 -3
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/authentication.js +1 -15
- package/dist/selectors/metadata.js +1 -1
- package/dist/sharedMessages.js +1 -17
- package/dist/utils/propertyHelper.js +0 -33
- package/dist/utils/timezoneHelper.js +1 -23
- package/package.json +7 -10
- package/src/actions/modules.js +10 -0
- package/src/actions/modules.test.js +14 -0
- package/src/actions/navigation.js +0 -7
- package/src/actions/navigation.test.js +0 -12
- package/src/actions/scopes.js +1 -2
- package/src/actions/scopes.test.js +1 -2
- package/src/buildStore.js +0 -6
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +3 -4
- package/src/components/Form/InputField.test.js +0 -18
- package/src/components/Form/Inputs/Date.test.js +0 -18
- package/src/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/src/components/MaterialUI/DataDisplay/Notification.test.js +0 -37
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +5 -23
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +0 -121
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -20
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -2
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +8 -8
- package/src/components/MaterialUI/DataDisplay/tableHelpers.test.js +0 -93
- package/src/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/src/components/MaterialUI/Inputs/Autocomplete.test.js +0 -15
- package/src/components/MaterialUI/Inputs/DatePicker.js +3 -17
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +1 -143
- package/src/components/MaterialUI/Inputs/InputBase.js +15 -103
- package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -376
- package/src/components/MaterialUI/Inputs/InputBaseProps.js +0 -6
- package/src/components/MaterialUI/Inputs/InputBaseProps.test.js +0 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +27 -39
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +34 -39
- package/src/components/MaterialUI/Inputs/TimePicker.js +1 -5
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +1 -2
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +0 -52
- package/src/components/Routing/Page.js +1 -12
- package/src/components/Routing/SegmentPage.js +1 -12
- package/src/components/Routing/SubPage.js +9 -41
- package/src/components/Routing/SubPage.test.js +1 -295
- package/src/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/src/components/Scope/useScopeConfirmationModalState.test.js +35 -4
- package/src/components/Text.test.js +59 -44
- package/src/constants.js +0 -15
- package/src/content/icons/hide.svg +1 -10
- package/src/content/icons/open-in-new-tab.svg +1 -3
- package/src/content/iconsSheet.svg +650 -117
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +2 -12
- package/src/hooks/useEditState.test.js +1 -1
- package/src/hooks/useLabelMessage.test.js +10 -16
- package/src/reducers/modules.js +4 -4
- package/src/reducers/modules.test.js +5 -5
- package/src/reducers/navigation.js +0 -24
- package/src/reducers/navigation.test.js +0 -38
- package/src/reducers/request.js +1 -6
- package/src/reducers/request.test.js +0 -34
- package/src/reducers/scopes.js +0 -3
- package/src/reducers/scopes.test.js +0 -47
- package/src/reducers/view.js +1 -1
- package/src/reducers/view.test.js +8 -1
- package/src/selectors/authentication.js +0 -13
- package/src/selectors/authentication.test.js +0 -322
- package/src/selectors/metadata.js +1 -1
- package/src/selectors/metadata.test.js +0 -12
- package/src/sharedMessages.js +1 -17
- package/src/translations/en-US.json +12 -16
- package/src/translations/fr-CA.json +12 -16
- package/src/utils/propertyHelper.js +0 -38
- package/src/utils/propertyHelper.test.js +0 -160
- package/src/utils/timezoneHelper.js +0 -18
- package/src/utils/timezoneHelper.test.js +1 -23
- package/dist/actions/globalErrorMessages.js +0 -63
- package/dist/actions/tasks.js +0 -170
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -160
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -88
- package/dist/components/TaskDetailsModal.js +0 -191
- package/dist/content/icons/anonymize.svg +0 -3
- package/dist/content/icons/archives.svg +0 -3
- package/dist/content/icons/clean-index.svg +0 -3
- package/dist/content/icons/date-index.svg +0 -3
- package/dist/content/icons/inventory.svg +0 -4
- package/dist/content/icons/query-tester.svg +0 -10
- package/dist/content/icons/reciprocity.svg +0 -10
- package/dist/content/icons/schema.svg +0 -11
- package/dist/content/icons/synonyms.svg +0 -3
- package/dist/content/icons/tenant.svg +0 -3
- package/dist/content/icons/time-index.svg +0 -3
- package/dist/hooks/useDispatchWithErrorHandling.js +0 -103
- package/dist/hooks/useScopeGuardLoader.js +0 -77
- package/dist/reducers/globalErrorMessages.js +0 -78
- package/dist/reducers/scopeRouteState.js +0 -83
- package/dist/reducers/tasks.js +0 -98
- package/dist/selectors/globalErrorMessages.js +0 -57
- package/dist/selectors/scopeRouteState.js +0 -53
- package/dist/selectors/tasks.js +0 -64
- package/dist/utils/responseProcessingHelper.js +0 -86
- package/src/actions/globalErrorMessages.js +0 -12
- package/src/actions/globalErrorMessages.test.js +0 -21
- package/src/actions/tasks.js +0 -77
- package/src/actions/tasks.test.js +0 -169
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -108
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.test.js +0 -468
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -29
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.test.js +0 -147
- package/src/components/TaskDetailsModal.js +0 -132
- package/src/components/TaskDetailsModal.test.js +0 -317
- package/src/content/icons/anonymize.svg +0 -3
- package/src/content/icons/archives.svg +0 -3
- package/src/content/icons/clean-index.svg +0 -3
- package/src/content/icons/date-index.svg +0 -3
- package/src/content/icons/inventory.svg +0 -4
- package/src/content/icons/query-tester.svg +0 -10
- package/src/content/icons/reciprocity.svg +0 -10
- package/src/content/icons/schema.svg +0 -11
- package/src/content/icons/synonyms.svg +0 -3
- package/src/content/icons/tenant.svg +0 -3
- package/src/content/icons/time-index.svg +0 -3
- package/src/hooks/useDispatchWithErrorHandling.js +0 -57
- package/src/hooks/useDispatchWithErrorHandling.test.js +0 -230
- package/src/hooks/useScopeGuardLoader.js +0 -25
- package/src/hooks/useScopeGuardLoader.test.js +0 -187
- package/src/reducers/globalErrorMessages.js +0 -25
- package/src/reducers/globalErrorMessages.test.js +0 -66
- package/src/reducers/scopeRouteState.js +0 -29
- package/src/reducers/scopeRouteState.test.js +0 -49
- package/src/reducers/tasks.js +0 -56
- package/src/reducers/tasks.test.js +0 -404
- package/src/selectors/globalErrorMessages.js +0 -11
- package/src/selectors/globalErrorMessages.test.js +0 -25
- package/src/selectors/scopeRouteState.js +0 -5
- package/src/selectors/scopeRouteState.test.js +0 -13
- package/src/selectors/tasks.js +0 -16
- package/src/selectors/tasks.test.js +0 -60
- package/src/utils/responseProcessingHelper.js +0 -42
- package/src/utils/responseProcessingHelper.test.js +0 -218
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { mount } from "enzyme";
|
|
3
|
-
import InputBase
|
|
3
|
+
import InputBase from "./InputBase";
|
|
4
4
|
import InputBaseMUI from "@material-ui/core/InputBase";
|
|
5
5
|
import sinon from "sinon";
|
|
6
6
|
import { ignoreConsoleError } from "../../../utils/testUtils";
|
|
7
7
|
import InputBaseProps from "./InputBaseProps";
|
|
8
8
|
import { act } from "unexpected-reaction";
|
|
9
|
-
import { fireEvent, render, getByDisplayValue } from "@testing-library/react";
|
|
10
9
|
|
|
11
10
|
describe("InputBase Component", () => {
|
|
12
11
|
let update, container;
|
|
@@ -58,45 +57,6 @@ describe("InputBase Component", () => {
|
|
|
58
57
|
expect(mountedComponent.prop("inputProps").get(InputBaseProps.propNames.value), "to equal", aValue + aValue);
|
|
59
58
|
});
|
|
60
59
|
|
|
61
|
-
it("Renders multiline InputBase component with default number of rows", () => {
|
|
62
|
-
const inputProps = new InputBaseProps();
|
|
63
|
-
const aLabel = "aLabel";
|
|
64
|
-
const aValue = "value";
|
|
65
|
-
const defaultRows = 4;
|
|
66
|
-
|
|
67
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
68
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
69
|
-
inputProps.set(InputBaseProps.propNames.type, "text");
|
|
70
|
-
inputProps.set(InputBaseProps.propNames.multiline, true);
|
|
71
|
-
|
|
72
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
73
|
-
|
|
74
|
-
const mountedComponent = mount(component);
|
|
75
|
-
const expected = <InputBaseMUI value={aValue} title={aValue} minRows={defaultRows} />;
|
|
76
|
-
|
|
77
|
-
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("Renders multiline InputBase component with desired number of rows", () => {
|
|
81
|
-
const inputProps = new InputBaseProps();
|
|
82
|
-
const aLabel = "aLabel";
|
|
83
|
-
const aValue = "value";
|
|
84
|
-
const desiredNumberOfRows = 20;
|
|
85
|
-
|
|
86
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
87
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
88
|
-
inputProps.set(InputBaseProps.propNames.type, "text");
|
|
89
|
-
inputProps.set(InputBaseProps.propNames.multiline, true);
|
|
90
|
-
inputProps.set(InputBaseProps.propNames.rows, desiredNumberOfRows);
|
|
91
|
-
|
|
92
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
93
|
-
|
|
94
|
-
const mountedComponent = mount(component);
|
|
95
|
-
const expected = <InputBaseMUI value={aValue} title={aValue} minRows={desiredNumberOfRows} />;
|
|
96
|
-
|
|
97
|
-
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
98
|
-
});
|
|
99
|
-
|
|
100
60
|
it("Renders InputBase component with title attribute for input of type text", () => {
|
|
101
61
|
const inputProps = new InputBaseProps();
|
|
102
62
|
const aLabel = "aLabel";
|
|
@@ -286,35 +246,6 @@ describe("InputBase Component", () => {
|
|
|
286
246
|
|
|
287
247
|
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
288
248
|
});
|
|
289
|
-
|
|
290
|
-
it("Change value on blur with pending timer", () => {
|
|
291
|
-
window.bypassDebounce = false;
|
|
292
|
-
const inputProps = new InputBaseProps();
|
|
293
|
-
const aLabel = "aLabel";
|
|
294
|
-
const aValue = "12.2";
|
|
295
|
-
const metadata = {
|
|
296
|
-
test: "value",
|
|
297
|
-
};
|
|
298
|
-
const onBlur = sinon.spy().named("blur");
|
|
299
|
-
|
|
300
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
301
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
302
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
303
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
304
|
-
inputProps.set(InputBaseProps.propNames.onBlur, onBlur);
|
|
305
|
-
inputProps.set(InputBaseProps.propNames.timeoutDelay, 1000);
|
|
306
|
-
|
|
307
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
308
|
-
const mountedComponent = mount(component);
|
|
309
|
-
const input = mountedComponent.find("input");
|
|
310
|
-
|
|
311
|
-
input.simulate("change", { target: { value: "13", focus: () => {} } });
|
|
312
|
-
input.simulate("blur", {});
|
|
313
|
-
|
|
314
|
-
expect(onBlur, "was called once");
|
|
315
|
-
expect(update, "not to have calls satisfying", [{ args: [aValue, metadata] }]);
|
|
316
|
-
expect(update, "to have calls satisfying", [{ args: ["13", metadata] }]);
|
|
317
|
-
});
|
|
318
249
|
});
|
|
319
250
|
|
|
320
251
|
describe("InputBase component debouce", () => {
|
|
@@ -380,309 +311,3 @@ describe("InputBase component debouce", () => {
|
|
|
380
311
|
expect(input.get(0).props.value, "to equal", "");
|
|
381
312
|
});
|
|
382
313
|
});
|
|
383
|
-
|
|
384
|
-
describe("AdvancedNumericInput", () => {
|
|
385
|
-
const noop = function () {};
|
|
386
|
-
let update, container;
|
|
387
|
-
beforeEach(() => {
|
|
388
|
-
window.bypassDebounce = true;
|
|
389
|
-
jest.useFakeTimers();
|
|
390
|
-
|
|
391
|
-
container = document.createElement("div");
|
|
392
|
-
document.body.appendChild(container);
|
|
393
|
-
update = sinon.spy().named("update");
|
|
394
|
-
});
|
|
395
|
-
afterEach(() => {
|
|
396
|
-
jest.useRealTimers();
|
|
397
|
-
delete window.bypassDebounce;
|
|
398
|
-
document.body.removeChild(container);
|
|
399
|
-
container = null;
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
it("Renders InputBase component as advanced numeric input", () => {
|
|
403
|
-
const inputProps = new InputBaseProps();
|
|
404
|
-
const aLabel = "aLabel";
|
|
405
|
-
const aValue = "value";
|
|
406
|
-
|
|
407
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
408
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
409
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
410
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
411
|
-
|
|
412
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
413
|
-
|
|
414
|
-
const mountedComponent = mount(component);
|
|
415
|
-
const expected = <InputBaseMUI value={aValue} title="" inputComponent={AdvancedNumericInput} />;
|
|
416
|
-
|
|
417
|
-
expect(mountedComponent.containsMatchingElement(expected), "to be truthy");
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
it("Renders InputBase component as advanced numeric input with custom numeric props", () => {
|
|
421
|
-
const inputProps = new InputBaseProps();
|
|
422
|
-
const aLabel = "aLabel";
|
|
423
|
-
const aValue = "value";
|
|
424
|
-
|
|
425
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
426
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
427
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
428
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
429
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
430
|
-
|
|
431
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
432
|
-
|
|
433
|
-
const mountedComponent = mount(component);
|
|
434
|
-
|
|
435
|
-
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
436
|
-
expect(advInput.props().decimalScale, "to be", 2);
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it("Change advanced numeric input value", () => {
|
|
440
|
-
const inputProps = new InputBaseProps();
|
|
441
|
-
const aLabel = "aLabel";
|
|
442
|
-
const aValue = "12.2";
|
|
443
|
-
const metadata = {
|
|
444
|
-
test: "value",
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
448
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
449
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
450
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
451
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
452
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
453
|
-
|
|
454
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
455
|
-
const mountedComponent = mount(component);
|
|
456
|
-
const input = mountedComponent.find("input");
|
|
457
|
-
input.simulate("change", { target: { value: "13", focus: noop } });
|
|
458
|
-
|
|
459
|
-
expect(update, "to have calls satisfying", [{ args: ["13", metadata] }]);
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
it("Change advanced numeric input on blur without custom blur method", () => {
|
|
463
|
-
const inputProps = new InputBaseProps();
|
|
464
|
-
const aLabel = "aLabel";
|
|
465
|
-
const aValue = "12.2";
|
|
466
|
-
const metadata = {
|
|
467
|
-
test: "value",
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
471
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
472
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
473
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
474
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
475
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
476
|
-
|
|
477
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
478
|
-
const mountedComponent = mount(component);
|
|
479
|
-
const input = mountedComponent.find("input");
|
|
480
|
-
|
|
481
|
-
input.simulate("blur", {});
|
|
482
|
-
|
|
483
|
-
expect(update, "to have calls satisfying", [{ args: ["12.20", metadata] }]);
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
it("Onblur send a formatted string instead of a number", () => {
|
|
487
|
-
const inputProps = new InputBaseProps();
|
|
488
|
-
const aLabel = "aLabel";
|
|
489
|
-
const aValue = 12.2;
|
|
490
|
-
const metadata = {
|
|
491
|
-
test: "value",
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
495
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
496
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
497
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
498
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
499
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
500
|
-
|
|
501
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
502
|
-
const mountedComponent = mount(component);
|
|
503
|
-
const input = mountedComponent.find("input");
|
|
504
|
-
|
|
505
|
-
input.simulate("blur", {});
|
|
506
|
-
|
|
507
|
-
expect(update, "to have calls satisfying", [{ args: ["12.20", metadata] }]);
|
|
508
|
-
});
|
|
509
|
-
|
|
510
|
-
it("Onblur send a formatted string with default numeric input props", () => {
|
|
511
|
-
const inputProps = new InputBaseProps();
|
|
512
|
-
const aLabel = "aLabel";
|
|
513
|
-
const aValue = 12.2;
|
|
514
|
-
const metadata = {
|
|
515
|
-
test: "value",
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
519
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
520
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
521
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
522
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
523
|
-
|
|
524
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
525
|
-
const mountedComponent = mount(component);
|
|
526
|
-
const input = mountedComponent.find("input");
|
|
527
|
-
|
|
528
|
-
input.simulate("blur", {});
|
|
529
|
-
|
|
530
|
-
expect(update, "to have calls satisfying", [{ args: ["12.2", metadata] }]);
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
it("Onblur send an unformatted string when blurFormattingSkipFixedDecimalScale is true", () => {
|
|
534
|
-
const inputProps = new InputBaseProps();
|
|
535
|
-
const aLabel = "aLabel";
|
|
536
|
-
const aValue = 12.2;
|
|
537
|
-
const metadata = {
|
|
538
|
-
test: "value",
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
542
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
543
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
544
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
545
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, {
|
|
546
|
-
decimalScale: 2,
|
|
547
|
-
blurFormattingSkipFixedDecimalScale: true,
|
|
548
|
-
});
|
|
549
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
550
|
-
|
|
551
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
552
|
-
const mountedComponent = mount(component);
|
|
553
|
-
const input = mountedComponent.find("input");
|
|
554
|
-
|
|
555
|
-
input.simulate("blur", {});
|
|
556
|
-
|
|
557
|
-
expect(update, "to have calls satisfying", [{ args: ["12.2", metadata] }]);
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
it("Onblur send an empty string when the initial value is empty", () => {
|
|
561
|
-
const inputProps = new InputBaseProps();
|
|
562
|
-
const aLabel = "aLabel";
|
|
563
|
-
const aValue = null;
|
|
564
|
-
const metadata = {
|
|
565
|
-
test: "value",
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
569
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
570
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
571
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
572
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
573
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
574
|
-
|
|
575
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
576
|
-
const mountedComponent = mount(component);
|
|
577
|
-
const input = mountedComponent.find("input");
|
|
578
|
-
|
|
579
|
-
input.simulate("blur", {});
|
|
580
|
-
|
|
581
|
-
expect(update, "to have calls satisfying", [{ args: ["", metadata] }]);
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
it("Change advanced numeric input on blur with no pending timer", () => {
|
|
585
|
-
const inputProps = new InputBaseProps();
|
|
586
|
-
const aLabel = "aLabel";
|
|
587
|
-
const aValue = "12.2";
|
|
588
|
-
const metadata = {
|
|
589
|
-
test: "value",
|
|
590
|
-
};
|
|
591
|
-
const onBlur = sinon.spy().named("blur");
|
|
592
|
-
|
|
593
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
594
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
595
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
596
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
597
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
598
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
599
|
-
inputProps.set(InputBaseProps.propNames.onBlur, onBlur);
|
|
600
|
-
|
|
601
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
602
|
-
const mountedComponent = mount(component);
|
|
603
|
-
const input = mountedComponent.find("input");
|
|
604
|
-
|
|
605
|
-
input.simulate("blur", {});
|
|
606
|
-
|
|
607
|
-
expect(onBlur, "was called once");
|
|
608
|
-
expect(update, "to have calls satisfying", [{ args: ["12.20", metadata] }]);
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
it("Change advanced numeric input on blur with pending timer", () => {
|
|
612
|
-
window.bypassDebounce = false;
|
|
613
|
-
const inputProps = new InputBaseProps();
|
|
614
|
-
const aLabel = "aLabel";
|
|
615
|
-
const aValue = "12.2";
|
|
616
|
-
const metadata = {
|
|
617
|
-
test: "value",
|
|
618
|
-
};
|
|
619
|
-
const onBlur = sinon.spy().named("blur");
|
|
620
|
-
|
|
621
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
622
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
623
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
624
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
625
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
626
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
627
|
-
inputProps.set(InputBaseProps.propNames.onBlur, onBlur);
|
|
628
|
-
inputProps.set(InputBaseProps.propNames.timeoutDelay, 1000);
|
|
629
|
-
|
|
630
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
631
|
-
const mountedComponent = mount(component);
|
|
632
|
-
const input = mountedComponent.find("input");
|
|
633
|
-
|
|
634
|
-
input.simulate("change", { target: { value: "13", focus: noop } });
|
|
635
|
-
input.simulate("blur", {});
|
|
636
|
-
|
|
637
|
-
expect(onBlur, "was called once");
|
|
638
|
-
expect(update, "not to have calls satisfying", [{ args: [aValue, metadata] }]);
|
|
639
|
-
expect(update, "to have calls satisfying", [{ args: ["13.00", metadata] }]);
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
it("Local state is reset when the value props changes for the same value as inputText", () => {
|
|
643
|
-
window.bypassDebounce = false;
|
|
644
|
-
const inputProps = new InputBaseProps();
|
|
645
|
-
const aLabel = "aLabel";
|
|
646
|
-
const aValue = "12.2";
|
|
647
|
-
const metadata = {
|
|
648
|
-
test: "value",
|
|
649
|
-
};
|
|
650
|
-
const onBlur = sinon.spy().named("blur");
|
|
651
|
-
|
|
652
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
653
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
654
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
655
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
656
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
657
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
658
|
-
inputProps.set(InputBaseProps.propNames.onBlur, onBlur);
|
|
659
|
-
inputProps.set(InputBaseProps.propNames.timeoutDelay, 1000);
|
|
660
|
-
|
|
661
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
662
|
-
const { container, rerender } = render(component);
|
|
663
|
-
|
|
664
|
-
const input = getByDisplayValue(container, "12.2");
|
|
665
|
-
|
|
666
|
-
fireEvent.change(input, {
|
|
667
|
-
target: {
|
|
668
|
-
value: "13",
|
|
669
|
-
},
|
|
670
|
-
});
|
|
671
|
-
|
|
672
|
-
const inputProps2 = new InputBaseProps();
|
|
673
|
-
inputProps2.set(InputBaseProps.propNames.update, update);
|
|
674
|
-
inputProps2.set(InputBaseProps.propNames.value, "13");
|
|
675
|
-
inputProps2.set(InputBaseProps.propNames.label, aLabel);
|
|
676
|
-
inputProps2.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
677
|
-
inputProps2.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
678
|
-
inputProps2.set(InputBaseProps.propNames.metadata, metadata);
|
|
679
|
-
inputProps2.set(InputBaseProps.propNames.onBlur, onBlur);
|
|
680
|
-
inputProps2.set(InputBaseProps.propNames.timeoutDelay, 1000);
|
|
681
|
-
|
|
682
|
-
act(() => {
|
|
683
|
-
rerender(<InputBase inputProps={inputProps2} />);
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
// no idea what to assert here, this test is mostly for code coverage
|
|
687
|
-
});
|
|
688
|
-
});
|
|
@@ -17,9 +17,6 @@ class InputBaseProps extends ComponentProps {
|
|
|
17
17
|
endAdornment: "endAdornment",
|
|
18
18
|
metadata: "metadata",
|
|
19
19
|
autoComplete: "autoComplete",
|
|
20
|
-
timeoutDelay: "timeoutDelay",
|
|
21
|
-
rows: "rows",
|
|
22
|
-
numericInputProps: "numericInputProps",
|
|
23
20
|
};
|
|
24
21
|
|
|
25
22
|
static ruleNames = {
|
|
@@ -44,9 +41,6 @@ class InputBaseProps extends ComponentProps {
|
|
|
44
41
|
this.componentProps.set(this.constructor.propNames.endAdornment, null);
|
|
45
42
|
this.componentProps.set(this.constructor.propNames.metadata, null);
|
|
46
43
|
this.componentProps.set(this.constructor.propNames.autoComplete, null);
|
|
47
|
-
this.componentProps.set(this.constructor.propNames.timeoutDelay, null);
|
|
48
|
-
this.componentProps.set(this.constructor.propNames.rows, null);
|
|
49
|
-
this.componentProps.set(this.constructor.propNames.numericInputProps, null);
|
|
50
44
|
|
|
51
45
|
this.componentClasses.set(this.constructor.ruleNames.input, null);
|
|
52
46
|
this.componentClasses.set(this.constructor.ruleNames.errorText, null);
|
|
@@ -18,9 +18,6 @@ describe("InputBase Props", () => {
|
|
|
18
18
|
"endAdornment",
|
|
19
19
|
"metadata",
|
|
20
20
|
"autoComplete",
|
|
21
|
-
"timeoutDelay",
|
|
22
|
-
"rows",
|
|
23
|
-
"numericInputProps",
|
|
24
21
|
];
|
|
25
22
|
|
|
26
23
|
expect(InputBaseProps.propNames, "to have keys", propNames);
|
|
@@ -43,9 +40,6 @@ describe("InputBase Props", () => {
|
|
|
43
40
|
"endAdornment",
|
|
44
41
|
"metadata",
|
|
45
42
|
"autoComplete",
|
|
46
|
-
"timeoutDelay",
|
|
47
|
-
"rows",
|
|
48
|
-
"numericInputProps",
|
|
49
43
|
];
|
|
50
44
|
|
|
51
45
|
const ruleNames = ["input", "errorText"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState, useRef } from "react";
|
|
2
2
|
import { makeStyles } from "@material-ui/core/styles";
|
|
3
3
|
import SelectProps from "../SelectProps";
|
|
4
4
|
import Icon from "../../DataDisplay/Icon";
|
|
@@ -80,9 +80,12 @@ export const useStyles = makeStyles(theme => ({
|
|
|
80
80
|
},
|
|
81
81
|
parentInput: {
|
|
82
82
|
flex: "13 0 0",
|
|
83
|
-
zIndex: 1,
|
|
84
|
-
border:
|
|
85
|
-
|
|
83
|
+
zIndex: props => (props.focused ? 99 : 1),
|
|
84
|
+
border: props =>
|
|
85
|
+
props.focused
|
|
86
|
+
? `${theme.spacing(0.1)} solid ${theme.palette.focus}`
|
|
87
|
+
: `${theme.spacing(0.1)} solid ${theme.palette.grey.borders}`,
|
|
88
|
+
boxShadow: props => (props.focused ? `0 0 4px ${theme.palette.focus}` : "none"),
|
|
86
89
|
width: "100%",
|
|
87
90
|
display: "inherit",
|
|
88
91
|
marginLeft: theme.spacing(-0.1),
|
|
@@ -101,11 +104,6 @@ export const useStyles = makeStyles(theme => ({
|
|
|
101
104
|
borderBottomLeftRadius: 0,
|
|
102
105
|
},
|
|
103
106
|
},
|
|
104
|
-
"&:focus-within": {
|
|
105
|
-
zIndex: 99,
|
|
106
|
-
border: `${theme.spacing(0.1)} solid ${theme.palette.focus}`,
|
|
107
|
-
boxShadow: `0 0 4px ${theme.palette.focus}`,
|
|
108
|
-
},
|
|
109
107
|
},
|
|
110
108
|
selectRoot: {
|
|
111
109
|
zIndex: 10,
|
|
@@ -151,30 +149,17 @@ const SearchControl = ({
|
|
|
151
149
|
searchOption,
|
|
152
150
|
onSearch = () => {},
|
|
153
151
|
disabled,
|
|
154
|
-
focusAndSelectSearchFieldOnLoad = true,
|
|
155
|
-
focusSearchOnSearchOptionChange = false,
|
|
156
152
|
}) => {
|
|
157
153
|
searchOptions = !searchOptions?.length ? null : searchOptions;
|
|
158
154
|
searchOption = getSearchOptionValue(searchOptions, searchOption);
|
|
155
|
+
const [inputFocused, setInputFocused] = useState(false);
|
|
159
156
|
|
|
160
|
-
const classes = useStyles();
|
|
157
|
+
const classes = useStyles({ focused: inputFocused });
|
|
161
158
|
|
|
162
159
|
const inputRef = useRef();
|
|
163
160
|
|
|
164
161
|
const update = value => {
|
|
165
|
-
|
|
166
|
-
onSearch(value, "");
|
|
167
|
-
setTimeout(() => {
|
|
168
|
-
/* istanbul ignore next */
|
|
169
|
-
if (inputRef.current) {
|
|
170
|
-
inputRef.current.value = "";
|
|
171
|
-
inputRef.current.focus();
|
|
172
|
-
inputRef.current.select();
|
|
173
|
-
}
|
|
174
|
-
}, 0);
|
|
175
|
-
} else {
|
|
176
|
-
onSearch(value, defaultValue);
|
|
177
|
-
}
|
|
162
|
+
onSearch(value, defaultValue);
|
|
178
163
|
};
|
|
179
164
|
|
|
180
165
|
const selectProps = new SelectProps();
|
|
@@ -193,28 +178,28 @@ const SearchControl = ({
|
|
|
193
178
|
selectProps.setStyle(SelectProps.ruleNames.root, classes.selectRoot);
|
|
194
179
|
selectProps.setStyle(SelectProps.ruleNames.paper, classes.selectPaper);
|
|
195
180
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
181
|
+
const handleKeyDown = e => {
|
|
182
|
+
if (e.key === "Enter") {
|
|
183
|
+
onSearch(searchOption, e.target.value);
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
e.stopPropagation();
|
|
201
186
|
}
|
|
202
|
-
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const onFocusedEvent = (event, focused) => {
|
|
190
|
+
setInputFocused(focused);
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
event.stopPropagation();
|
|
193
|
+
};
|
|
203
194
|
|
|
204
195
|
const SelectSection = () => {
|
|
205
196
|
if (searchOptions === null) return null;
|
|
206
197
|
else return <Select className={classes.selectInput} options={searchOptions} selectProps={selectProps} />;
|
|
207
198
|
};
|
|
208
199
|
|
|
209
|
-
const onSubmit = event => {
|
|
210
|
-
// using form submit instead of a keydown (with key=enter) to allow the 'enter key' event to be canceled elsewhere to avoid the submit event
|
|
211
|
-
onSearch(searchOption, inputRef.current?.value);
|
|
212
|
-
event.preventDefault();
|
|
213
|
-
};
|
|
214
|
-
|
|
215
200
|
const inputSection = (
|
|
216
|
-
<div data-qa="searchInput" className={classes.parentInput}>
|
|
217
|
-
<form data-qa="searchForm" className={classes.fullWidth}
|
|
201
|
+
<div data-qa="searchInput" data-qa-is-focused={inputFocused} className={classes.parentInput}>
|
|
202
|
+
<form data-qa="searchForm" className={classes.fullWidth}>
|
|
218
203
|
<Input
|
|
219
204
|
placeholder={placeholder}
|
|
220
205
|
defaultValue={defaultValue}
|
|
@@ -222,7 +207,10 @@ const SearchControl = ({
|
|
|
222
207
|
type="text"
|
|
223
208
|
disabled={disabled}
|
|
224
209
|
classes={{ input: classes.controlInput }}
|
|
210
|
+
onKeyDown={handleKeyDown}
|
|
225
211
|
disableUnderline={true}
|
|
212
|
+
onFocus={e => onFocusedEvent(e, true)}
|
|
213
|
+
onBlur={e => onFocusedEvent(e, false)}
|
|
226
214
|
endAdornment={
|
|
227
215
|
<InputAdornment position="start">
|
|
228
216
|
<IconButton
|
|
@@ -53,11 +53,10 @@ describe("useStyles", () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
describe("SearchControl Component", () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const stateSetter = sinon.spy().named("focus");
|
|
57
|
+
const useStateMock = initState => [initState, stateSetter];
|
|
58
|
+
|
|
59
59
|
afterEach(() => {
|
|
60
|
-
jest.useRealTimers();
|
|
61
60
|
jest.clearAllMocks();
|
|
62
61
|
});
|
|
63
62
|
|
|
@@ -233,7 +232,8 @@ describe("SearchControl Component", () => {
|
|
|
233
232
|
expect(searchInput.length, "to be", 1);
|
|
234
233
|
|
|
235
234
|
searchInput.instance().value = "abc";
|
|
236
|
-
|
|
235
|
+
searchInput.simulate("keydown", { key: "Tab" });
|
|
236
|
+
searchInput.simulate("keydown", { key: "Enter" });
|
|
237
237
|
|
|
238
238
|
expect(onSearchEvent, "to have calls satisfying", [{ args: ["aValue", "abc"] }]);
|
|
239
239
|
});
|
|
@@ -371,7 +371,7 @@ describe("SearchControl Component", () => {
|
|
|
371
371
|
expect(onSearchEvent, "to have calls satisfying", [{ args: ["anotherValue", "abcdef123"] }]);
|
|
372
372
|
});
|
|
373
373
|
|
|
374
|
-
it("Search Control should
|
|
374
|
+
it("Search Control should render with the 2nd value", () => {
|
|
375
375
|
const options = [
|
|
376
376
|
{ value: "aValue", label: "aLabel" },
|
|
377
377
|
{ value: "anotherValue", label: "anotherLabel" },
|
|
@@ -385,8 +385,8 @@ describe("SearchControl Component", () => {
|
|
|
385
385
|
placeholder="placeHolderTest"
|
|
386
386
|
defaultValue={"abcdef123"}
|
|
387
387
|
searchOptions={options}
|
|
388
|
+
searchOption={"anotherValue"}
|
|
388
389
|
onSearch={onSearchEvent}
|
|
389
|
-
focusSearchOnSearchOptionChange={true}
|
|
390
390
|
/>
|
|
391
391
|
</TestWrapper>
|
|
392
392
|
);
|
|
@@ -395,53 +395,48 @@ describe("SearchControl Component", () => {
|
|
|
395
395
|
|
|
396
396
|
const selectMui = mountedComponent.find(SelectMUI);
|
|
397
397
|
|
|
398
|
-
|
|
399
|
-
target: {
|
|
400
|
-
value: "anotherValue",
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
onSearchEvent.resetHistory();
|
|
405
|
-
|
|
406
|
-
selectMui.invoke("onChange")(event);
|
|
407
|
-
|
|
408
|
-
expect(onSearchEvent.callCount, "to equal", 1);
|
|
409
|
-
expect(onSearchEvent, "to have calls satisfying", [{ args: ["anotherValue", ""] }]);
|
|
410
|
-
|
|
411
|
-
const allInputs = mountedComponent.find("input");
|
|
412
|
-
const searchInput = allInputs.find("[placeholder='placeHolderTest']");
|
|
413
|
-
expect(searchInput.length, "to be", 1);
|
|
414
|
-
|
|
415
|
-
expect(searchInput.instance().value, "to be", "abcdef123");
|
|
416
|
-
jest.runOnlyPendingTimers();
|
|
417
|
-
expect(searchInput.instance().value, "to be", "");
|
|
398
|
+
expect(selectMui.props().value, "to equal", "anotherValue");
|
|
418
399
|
});
|
|
419
400
|
|
|
420
|
-
it("
|
|
401
|
+
it("focusing text input should set focus on container", () => {
|
|
402
|
+
jest.spyOn(React, "useState").mockImplementation(useStateMock);
|
|
403
|
+
|
|
421
404
|
const options = [
|
|
422
405
|
{ value: "aValue", label: "aLabel" },
|
|
423
406
|
{ value: "anotherValue", label: "anotherLabel" },
|
|
424
407
|
];
|
|
425
408
|
|
|
426
|
-
const onSearchEvent = sinon.spy().named("search");
|
|
427
|
-
|
|
428
409
|
const component = (
|
|
429
410
|
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
430
|
-
<SearchControl
|
|
431
|
-
placeholder="placeHolderTest"
|
|
432
|
-
defaultValue={"abcdef123"}
|
|
433
|
-
searchOptions={options}
|
|
434
|
-
searchOption={"anotherValue"}
|
|
435
|
-
onSearch={onSearchEvent}
|
|
436
|
-
/>
|
|
411
|
+
<SearchControl placeholder="placeHolderTest" searchOptions={options} />
|
|
437
412
|
</TestWrapper>
|
|
438
413
|
);
|
|
439
414
|
|
|
440
415
|
const mountedComponent = mount(component);
|
|
441
416
|
|
|
442
|
-
const
|
|
417
|
+
const allInputs = mountedComponent.find("input");
|
|
418
|
+
const searchInput = allInputs.find("[placeholder='placeHolderTest']");
|
|
419
|
+
expect(searchInput.length, "to be", 1);
|
|
443
420
|
|
|
444
|
-
|
|
421
|
+
let searchEditParent = mountedComponent.find('[data-qa="searchInput"]');
|
|
422
|
+
expect(searchEditParent.length, "to be", 1);
|
|
423
|
+
|
|
424
|
+
expect(searchEditParent.props()["data-qa-is-focused"], "to be", false);
|
|
425
|
+
|
|
426
|
+
const event = {
|
|
427
|
+
preventDefault: () => {},
|
|
428
|
+
stopPropagation: () => {},
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
searchInput.invoke("onFocus")(event);
|
|
432
|
+
|
|
433
|
+
searchEditParent = mountedComponent.find('[data-qa="searchInput"]');
|
|
434
|
+
expect(searchEditParent.props()["data-qa-is-focused"], "to be", true);
|
|
435
|
+
|
|
436
|
+
searchInput.invoke("onBlur")(event);
|
|
437
|
+
|
|
438
|
+
searchEditParent = mountedComponent.find('[data-qa="searchInput"]');
|
|
439
|
+
expect(searchEditParent.props()["data-qa-is-focused"], "to be", false);
|
|
445
440
|
});
|
|
446
441
|
|
|
447
442
|
it("Renders Search Control component without errors when disabled", () => {
|