@k-int/stripes-kint-components 1.3.0 → 1.7.0
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/CHANGELOG.md +34 -2
- package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +109 -0
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +998 -0
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +238 -0
- package/es/index.js +69 -17
- package/es/lib/ActionList/ActionList.js +63 -24
- package/es/lib/ActionList/ActionListFieldArray.js +158 -96
- package/es/lib/ActionList/index.js +7 -3
- package/es/lib/EditableRefdataList/EditableRefdataList.js +69 -24
- package/es/lib/EditableRefdataList/index.js +7 -3
- package/es/lib/EditableSettingsList/EditableSettingsList.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +90 -0
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +181 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +72 -9
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +447 -0
- package/es/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +45 -7
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +495 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +187 -0
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +180 -0
- package/es/lib/EditableSettingsList/SettingField/index.js +35 -0
- package/es/lib/EditableSettingsList/index.js +35 -0
- package/es/lib/NoResultsMessage/NoResultsMessage.js +122 -0
- package/es/lib/NoResultsMessage/index.js +19 -0
- package/es/lib/QueryTypedown/QueryTypedown.js +48 -9
- package/es/lib/QueryTypedown/index.js +6 -2
- package/es/lib/RefdataButtons/RefdataButtons.js +143 -0
- package/es/lib/RefdataButtons/index.js +19 -0
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +202 -131
- package/es/lib/SASQLookupComponent/index.js +6 -2
- package/es/lib/SASQRoute/SASQRoute.js +55 -18
- package/es/lib/SASQRoute/index.js +6 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +50 -11
- package/es/lib/SASQViewComponent/index.js +6 -2
- package/es/lib/SearchField/SearchField.js +48 -13
- package/es/lib/SearchField/index.js +6 -2
- package/es/lib/SettingPage/SettingPage.js +99 -0
- package/es/lib/SettingPage/SettingPagePane.js +83 -0
- package/es/lib/SettingPage/index.js +27 -0
- package/es/lib/TypeDown/TypeDown.js +143 -101
- package/es/lib/TypeDown/index.js +6 -2
- package/es/lib/Typedown/Typedown.js +140 -96
- package/es/lib/Typedown/index.js +6 -2
- package/es/lib/constants/eventCodes.js +31 -1
- package/es/lib/contexts/SettingsContext.js +41 -0
- package/es/lib/contexts/index.js +19 -0
- package/es/lib/hooks/index.js +42 -8
- package/es/lib/hooks/settingsHooks/index.js +27 -0
- package/es/lib/hooks/settingsHooks/useSettingSection.js +74 -0
- package/es/lib/hooks/settingsHooks/useSettings.js +175 -0
- package/es/lib/hooks/typedownHooks/index.js +8 -28
- package/es/lib/hooks/typedownHooks/useTypedown.js +129 -12
- package/es/lib/hooks/typedownHooks/useTypedownData.js +35 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +39 -6
- package/es/lib/hooks/useActiveElement.js +33 -2
- package/es/lib/hooks/useHelperApp.js +51 -12
- package/es/lib/hooks/useKiwtFieldArray.js +142 -0
- package/es/lib/hooks/useKiwtSASQuery.js +62 -7
- package/es/lib/hooks/useLocalStorageState.js +37 -4
- package/es/lib/hooks/useMutateRefdataValue.js +42 -9
- package/es/lib/hooks/useQIndex.js +108 -0
- package/es/lib/hooks/useRefdata.js +56 -12
- package/es/lib/hooks/useTemplates.js +36 -3
- package/es/lib/utils/buildUrl.js +43 -10
- package/es/lib/utils/generateKiwtQuery.js +31 -108
- package/es/lib/utils/generateKiwtQueryParams.js +154 -0
- package/es/lib/utils/index.js +55 -3
- package/es/lib/utils/refdataOptions.js +43 -0
- package/es/lib/utils/renderHelpText.js +109 -0
- package/es/lib/utils/selectorSafe.js +31 -2
- package/es/lib/utils/sortByLabel.js +55 -0
- package/es/lib/utils/toCamelCase.js +48 -0
- package/jest.config.js +15 -1
- package/junit.xml +79 -0
- package/package.json +17 -10
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +256 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +799 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +223 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +376 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +262 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +436 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +319 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +184 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +370 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +949 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +250 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +214 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +211 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +769 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +790 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +88 -0
- package/src/artifacts/coverage-jest/lcov-report/base.css +224 -0
- package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +87 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +116 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +97 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +131 -0
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +251 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +115 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +146 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +91 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +403 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +161 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +94 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +520 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +163 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +157 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +283 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +274 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +178 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +136 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +301 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +208 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +268 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/index.html +401 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.css +1 -0
- package/src/artifacts/coverage-jest/lcov-report/prettify.js +2 -0
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/sorter.js +196 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +193 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +109 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +286 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +236 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +121 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +106 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +166 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +103 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +130 -0
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +127 -0
- package/src/artifacts/coverage-jest/lcov.info +1999 -0
- package/src/index.js +21 -6
- package/src/lib/ActionList/ActionList.js +5 -2
- package/src/lib/ActionList/ActionListFieldArray.js +20 -8
- package/src/lib/ActionList/README.md +1 -0
- package/src/lib/ActionList/index.js +1 -1
- package/src/lib/EditableRefdataList/EditableRefdataList.js +10 -5
- package/src/lib/EditableRefdataList/index.js +1 -1
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsList.js +0 -0
- package/src/lib/{Settings → EditableSettingsList}/EditableSettingsListFieldArray.js +2 -2
- package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +111 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/EditSettingValue.js +24 -1
- package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +379 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/RenderSettingValue.js +2 -1
- package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +368 -0
- package/src/lib/{Settings → EditableSettingsList/SettingField}/SettingField.js +7 -7
- package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +80 -0
- package/src/lib/EditableSettingsList/SettingField/index.js +3 -0
- package/src/lib/EditableSettingsList/index.js +3 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +78 -0
- package/src/lib/NoResultsMessage/index.js +1 -0
- package/src/lib/{Settings → RefdataButtons}/RefdataButtons.js +1 -1
- package/src/lib/RefdataButtons/index.js +1 -0
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +36 -8
- package/src/lib/SASQRoute/README.md +1 -1
- package/src/lib/{Settings → SettingPage}/SettingPage.js +5 -5
- package/src/lib/{Settings → SettingPage}/SettingPagePane.js +12 -2
- package/src/lib/SettingPage/index.js +2 -0
- package/src/lib/TypeDown/README.md +1 -115
- package/src/lib/TypeDown/TypeDown.js +4 -2
- package/src/lib/Typedown/Typedown.js +2 -1
- package/src/lib/{Settings → contexts}/SettingsContext.js +1 -1
- package/src/lib/contexts/index.js +2 -0
- package/src/lib/hooks/README.md +107 -0
- package/src/lib/hooks/index.js +3 -0
- package/src/lib/hooks/settingsHooks/index.js +2 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettingSection.js +0 -0
- package/src/lib/{Settings → hooks/settingsHooks}/useSettings.js +14 -6
- package/src/lib/hooks/typedownHooks/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedown.js +93 -11
- package/src/lib/hooks/useHelperApp.js +5 -1
- package/src/lib/hooks/useKiwtFieldArray.js +63 -0
- package/src/lib/hooks/useKiwtSASQuery.js +9 -1
- package/src/lib/hooks/useQIndex.js +41 -0
- package/src/lib/hooks/useRefdata.js +17 -6
- package/src/lib/utils/README.md +39 -1
- package/src/lib/utils/generateKiwtQuery.js +3 -62
- package/src/lib/utils/generateKiwtQueryParams.js +67 -0
- package/src/lib/utils/index.js +10 -0
- package/src/lib/utils/refdataOptions.js +7 -0
- package/src/lib/{Settings/utils → utils}/renderHelpText.js +1 -1
- package/src/lib/{Settings/utils → utils}/sortByLabel.js +1 -1
- package/src/lib/{Settings/utils → utils}/toCamelCase.js +0 -0
- package/styles/NoResultsMessage.css +38 -0
- package/test/helpers/index.js +1 -0
- package/test/helpers/translationsProperties.js +40 -0
- package/test/jest/helpers/KintHarness.js +36 -0
- package/test/jest/helpers/index.js +2 -0
- package/test/jest/helpers/renderWithKintHarness.js +15 -0
- package/test/jest/jest-transformer.js +4 -0
- package/test/jest/setupTests.js +1 -0
- package/translations/stripes-kint-components/en.json +4 -1
- package/babelOptions.js +0 -30
- package/es/lib/Settings/EditableSettingsList.js +0 -57
- package/es/lib/Settings/EditableSettingsListFieldArray.js +0 -59
- package/es/lib/Settings/RefdataButtons.js +0 -100
- package/es/lib/Settings/SettingField.js +0 -144
- package/es/lib/Settings/SettingPage.js +0 -64
- package/es/lib/Settings/SettingPagePane.js +0 -43
- package/es/lib/Settings/SettingsContext.js +0 -18
- package/es/lib/Settings/index.js +0 -71
- package/es/lib/Settings/useSettingSection.js +0 -41
- package/es/lib/Settings/useSettings.js +0 -126
- package/es/lib/Settings/utils/index.js +0 -31
- package/es/lib/Settings/utils/renderHelpText.js +0 -57
- package/es/lib/Settings/utils/sortByLabel.js +0 -26
- package/es/lib/Settings/utils/toCamelCase.js +0 -19
- package/es/lib/hooks/typedownHooks/useTypedownFooter.js +0 -47
- package/es/lib/hooks/typedownHooks/useTypedownList.js +0 -45
- package/es/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -47
- package/es/lib/utils/getFocusableElements.js +0 -132
- package/src/lib/Settings/index.js +0 -8
- package/src/lib/Settings/utils/index.js +0 -3
- package/src/lib/hooks/typedownHooks/useTypedownFooter.js +0 -43
- package/src/lib/hooks/typedownHooks/useTypedownList.js +0 -36
- package/src/lib/hooks/typedownHooks/useTypedownSearchField.js +0 -39
- package/src/lib/utils/getFocusableElements.js +0 -99
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import '@folio/stripes-erm-components/test/jest/__mock__';
|
|
4
|
+
import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
|
|
5
|
+
|
|
6
|
+
import EditSettingValue from './EditSettingValue';
|
|
7
|
+
|
|
8
|
+
import { renderWithKintHarness } from '../../../../test/jest/helpers';
|
|
9
|
+
|
|
10
|
+
const onSubmit = jest.fn();
|
|
11
|
+
|
|
12
|
+
const stringSetting = {
|
|
13
|
+
id: '12345',
|
|
14
|
+
key: 'testSettingKey',
|
|
15
|
+
section: 'testSettingSection',
|
|
16
|
+
settingType: 'String',
|
|
17
|
+
value: 'diku-shared',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const refdata = [
|
|
21
|
+
{
|
|
22
|
+
id: '123',
|
|
23
|
+
value: 'test_refdata_value',
|
|
24
|
+
label: 'Test refdata value'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: '456',
|
|
28
|
+
value: 'other_refdata_value',
|
|
29
|
+
label: 'Other refdata value'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: '789',
|
|
33
|
+
value: 'final_refdata_value',
|
|
34
|
+
label: 'Final refdata value'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const moreRefdata = [
|
|
39
|
+
{
|
|
40
|
+
id: '123',
|
|
41
|
+
value: 'test_refdata_value',
|
|
42
|
+
label: 'Test refdata value'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: '234',
|
|
46
|
+
value: 'other_refdata_value',
|
|
47
|
+
label: 'Other refdata value'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: '345',
|
|
51
|
+
value: 'refdata_value_3',
|
|
52
|
+
label: 'Refdata value 3'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: '456',
|
|
56
|
+
value: 'refdata_value_4',
|
|
57
|
+
label: 'Refdata value 4'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: '567',
|
|
61
|
+
value: 'refdata_value_5',
|
|
62
|
+
label: 'Refdata value 5'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: '678',
|
|
66
|
+
value: 'final_refdata_value',
|
|
67
|
+
label: 'Final refdata value'
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const refdataSetting = {
|
|
72
|
+
id: '12345',
|
|
73
|
+
key: 'testSettingKey',
|
|
74
|
+
section: 'testSettingSection',
|
|
75
|
+
settingType: 'Refdata',
|
|
76
|
+
value: 'test_refdata_value',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const templates = [
|
|
80
|
+
{
|
|
81
|
+
id: 'abcde',
|
|
82
|
+
name: 'Test template'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: '98765',
|
|
86
|
+
name: 'Red herring template'
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const templateSetting = {
|
|
91
|
+
id: '12345',
|
|
92
|
+
key: 'testSettingKey',
|
|
93
|
+
section: 'testSettingSection',
|
|
94
|
+
settingType: 'Template',
|
|
95
|
+
value: 'abcde',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
describe('EditSettingValue', () => {
|
|
99
|
+
describe('edit string setting', () => {
|
|
100
|
+
describe('with no initial value', () => {
|
|
101
|
+
let renderComponent;
|
|
102
|
+
beforeEach(() => {
|
|
103
|
+
renderComponent = renderWithKintHarness(
|
|
104
|
+
<TestForm
|
|
105
|
+
initialValues={{}}
|
|
106
|
+
onSubmit={onSubmit}
|
|
107
|
+
>
|
|
108
|
+
<EditSettingValue
|
|
109
|
+
currentSetting={stringSetting}
|
|
110
|
+
input={{
|
|
111
|
+
name: 'test'
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
</TestForm>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
test('renders the edit field', () => {
|
|
118
|
+
const { getByRole } = renderComponent;
|
|
119
|
+
expect(getByRole('textbox', { name: 'Value for setting {name}' }));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe('with initial value', () => {
|
|
124
|
+
let renderComponent;
|
|
125
|
+
beforeEach(() => {
|
|
126
|
+
renderComponent = renderWithKintHarness(
|
|
127
|
+
<TestForm
|
|
128
|
+
initialValues={{
|
|
129
|
+
test: {
|
|
130
|
+
value: stringSetting.value
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
onSubmit={onSubmit}
|
|
134
|
+
>
|
|
135
|
+
<EditSettingValue
|
|
136
|
+
currentSetting={stringSetting}
|
|
137
|
+
input={{
|
|
138
|
+
name: 'test'
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
</TestForm>
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('renders the expected value in the edit field', () => {
|
|
146
|
+
const { getByRole } = renderComponent;
|
|
147
|
+
expect(getByRole('textbox', { name: 'Value for setting {name}' })).toHaveDisplayValue('diku-shared');
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// NOTE -- Password textbox works weirdly so isn't tested here
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
describe('edit refdata setting', () => {
|
|
156
|
+
describe('with no initial value for refdata with <4 options', () => {
|
|
157
|
+
let renderComponent;
|
|
158
|
+
beforeEach(() => {
|
|
159
|
+
renderComponent = renderWithKintHarness(
|
|
160
|
+
<TestForm
|
|
161
|
+
initialValues={{}}
|
|
162
|
+
onSubmit={onSubmit}
|
|
163
|
+
>
|
|
164
|
+
<EditSettingValue
|
|
165
|
+
currentSetting={refdataSetting}
|
|
166
|
+
input={{
|
|
167
|
+
name: 'test'
|
|
168
|
+
}}
|
|
169
|
+
refdata={refdata}
|
|
170
|
+
/>
|
|
171
|
+
</TestForm>
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
test('renders the expected radio buttons', () => {
|
|
175
|
+
const { getByRole } = renderComponent;
|
|
176
|
+
expect(getByRole('radio', { name: 'Test refdata value' }));
|
|
177
|
+
expect(getByRole('radio', { name: 'Other refdata value' }));
|
|
178
|
+
expect(getByRole('radio', { name: 'Final refdata value' }));
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('no radio buttons are checked', () => {
|
|
182
|
+
const { getByRole } = renderComponent;
|
|
183
|
+
expect(getByRole('radio', { name: 'Test refdata value' })).not.toHaveAttribute('checked');
|
|
184
|
+
expect(getByRole('radio', { name: 'Other refdata value' })).not.toHaveAttribute('checked');
|
|
185
|
+
expect(getByRole('radio', { name: 'Final refdata value' })).not.toHaveAttribute('checked');
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('with initial value for refdata with <4 options', () => {
|
|
190
|
+
let renderComponent;
|
|
191
|
+
beforeEach(() => {
|
|
192
|
+
renderComponent = renderWithKintHarness(
|
|
193
|
+
<TestForm
|
|
194
|
+
initialValues={{
|
|
195
|
+
test: {
|
|
196
|
+
value: refdataSetting.value
|
|
197
|
+
}
|
|
198
|
+
}}
|
|
199
|
+
onSubmit={onSubmit}
|
|
200
|
+
>
|
|
201
|
+
<EditSettingValue
|
|
202
|
+
currentSetting={refdataSetting}
|
|
203
|
+
input={{
|
|
204
|
+
name: 'test'
|
|
205
|
+
}}
|
|
206
|
+
refdata={refdata}
|
|
207
|
+
/>
|
|
208
|
+
</TestForm>
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test('renders the expected radio buttons', () => {
|
|
213
|
+
const { getByRole } = renderComponent;
|
|
214
|
+
expect(getByRole('radio', { name: 'Test refdata value' }));
|
|
215
|
+
expect(getByRole('radio', { name: 'Other refdata value' }));
|
|
216
|
+
expect(getByRole('radio', { name: 'Final refdata value' }));
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test('the correct radio button is checked', () => {
|
|
220
|
+
const { getByRole } = renderComponent;
|
|
221
|
+
expect(getByRole('radio', { name: 'Test refdata value' })).toHaveAttribute('checked');
|
|
222
|
+
expect(getByRole('radio', { name: 'Other refdata value' })).not.toHaveAttribute('checked');
|
|
223
|
+
expect(getByRole('radio', { name: 'Final refdata value' })).not.toHaveAttribute('checked');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe('with no initial value for refdata with >4 options', () => {
|
|
228
|
+
let renderComponent;
|
|
229
|
+
beforeEach(() => {
|
|
230
|
+
renderComponent = renderWithKintHarness(
|
|
231
|
+
<TestForm
|
|
232
|
+
initialValues={{}}
|
|
233
|
+
onSubmit={onSubmit}
|
|
234
|
+
>
|
|
235
|
+
<EditSettingValue
|
|
236
|
+
currentSetting={refdataSetting}
|
|
237
|
+
input={{
|
|
238
|
+
name: 'test'
|
|
239
|
+
}}
|
|
240
|
+
refdata={moreRefdata}
|
|
241
|
+
/>
|
|
242
|
+
</TestForm>
|
|
243
|
+
);
|
|
244
|
+
});
|
|
245
|
+
test('renders the expected select field', () => {
|
|
246
|
+
const { getByRole } = renderComponent;
|
|
247
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' }));
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test('renders the expected refdata options', () => {
|
|
251
|
+
const { getByRole } = renderComponent;
|
|
252
|
+
expect(getByRole('option', { name: 'Test refdata value' }));
|
|
253
|
+
expect(getByRole('option', { name: 'Other refdata value' }));
|
|
254
|
+
expect(getByRole('option', { name: 'Refdata value 3' }));
|
|
255
|
+
expect(getByRole('option', { name: 'Refdata value 4' }));
|
|
256
|
+
expect(getByRole('option', { name: 'Refdata value 5' }));
|
|
257
|
+
expect(getByRole('option', { name: 'Final refdata value' }));
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe('with initial value for refdata with >4 options', () => {
|
|
262
|
+
let renderComponent;
|
|
263
|
+
beforeEach(() => {
|
|
264
|
+
renderComponent = renderWithKintHarness(
|
|
265
|
+
<TestForm
|
|
266
|
+
initialValues={{
|
|
267
|
+
test: {
|
|
268
|
+
value: refdataSetting.value
|
|
269
|
+
}
|
|
270
|
+
}}
|
|
271
|
+
onSubmit={onSubmit}
|
|
272
|
+
>
|
|
273
|
+
<EditSettingValue
|
|
274
|
+
currentSetting={refdataSetting}
|
|
275
|
+
input={{
|
|
276
|
+
name: 'test'
|
|
277
|
+
}}
|
|
278
|
+
refdata={moreRefdata}
|
|
279
|
+
/>
|
|
280
|
+
</TestForm>
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
test('renders the expected refdata options', () => {
|
|
285
|
+
const { getByRole } = renderComponent;
|
|
286
|
+
expect(getByRole('option', { name: 'Test refdata value' }));
|
|
287
|
+
expect(getByRole('option', { name: 'Other refdata value' }));
|
|
288
|
+
expect(getByRole('option', { name: 'Refdata value 3' }));
|
|
289
|
+
expect(getByRole('option', { name: 'Refdata value 4' }));
|
|
290
|
+
expect(getByRole('option', { name: 'Refdata value 5' }));
|
|
291
|
+
expect(getByRole('option', { name: 'Final refdata value' }));
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
test('renders the expected value in the refdata dropdown', () => {
|
|
295
|
+
const { getByRole } = renderComponent;
|
|
296
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' })).toHaveDisplayValue('Test refdata value');
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
describe('edit template setting', () => {
|
|
302
|
+
describe('with no initial value', () => {
|
|
303
|
+
let renderComponent;
|
|
304
|
+
beforeEach(() => {
|
|
305
|
+
renderComponent = renderWithKintHarness(
|
|
306
|
+
<TestForm
|
|
307
|
+
initialValues={{}}
|
|
308
|
+
onSubmit={onSubmit}
|
|
309
|
+
>
|
|
310
|
+
<EditSettingValue
|
|
311
|
+
currentSetting={templateSetting}
|
|
312
|
+
input={{
|
|
313
|
+
name: 'test'
|
|
314
|
+
}}
|
|
315
|
+
templates={templates}
|
|
316
|
+
/>
|
|
317
|
+
</TestForm>
|
|
318
|
+
);
|
|
319
|
+
});
|
|
320
|
+
test('renders the edit field', () => {
|
|
321
|
+
const { getByRole } = renderComponent;
|
|
322
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' }));
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
test('renders the expected template options', () => {
|
|
326
|
+
const { getByRole } = renderComponent;
|
|
327
|
+
expect(getByRole('option', { name: '' })); // empty option
|
|
328
|
+
expect(getByRole('option', { name: 'Test template' }));
|
|
329
|
+
expect(getByRole('option', { name: 'Red herring template' }));
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
test('renders expected display item in template dropdown', () => {
|
|
333
|
+
const { getByRole } = renderComponent;
|
|
334
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' })).toHaveDisplayValue('');
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe('with initial value', () => {
|
|
339
|
+
let renderComponent;
|
|
340
|
+
beforeEach(() => {
|
|
341
|
+
renderComponent = renderWithKintHarness(
|
|
342
|
+
<TestForm
|
|
343
|
+
initialValues={{
|
|
344
|
+
test: {
|
|
345
|
+
value: templateSetting.value
|
|
346
|
+
}
|
|
347
|
+
}}
|
|
348
|
+
onSubmit={onSubmit}
|
|
349
|
+
>
|
|
350
|
+
<EditSettingValue
|
|
351
|
+
currentSetting={templateSetting}
|
|
352
|
+
input={{
|
|
353
|
+
name: 'test'
|
|
354
|
+
}}
|
|
355
|
+
templates={templates}
|
|
356
|
+
/>
|
|
357
|
+
</TestForm>
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
test('renders the edit field', () => {
|
|
362
|
+
const { getByRole } = renderComponent;
|
|
363
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' }));
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
test('renders the expected template options', () => {
|
|
367
|
+
const { getByRole } = renderComponent;
|
|
368
|
+
expect(getByRole('option', { name: '' })); // empty option
|
|
369
|
+
expect(getByRole('option', { name: 'Test template' }));
|
|
370
|
+
expect(getByRole('option', { name: 'Red herring template' }));
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test('renders expected display item in template dropdown', () => {
|
|
374
|
+
const { getByRole } = renderComponent;
|
|
375
|
+
expect(getByRole('combobox', { name: 'Value for setting {name}' })).toHaveDisplayValue('Test template');
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
});
|
|
@@ -19,7 +19,8 @@ const RenderSettingValue = (props) => {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if (setting.defValue) {
|
|
22
|
-
|
|
22
|
+
const defValue = refdata?.filter((obj) => obj.value === setting.defValue)[0]?.label;
|
|
23
|
+
return `${defaultText} ${defValue}`;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
return NoCurrentValue;
|