@k-int/stripes-kint-components 5.31.2 → 5.31.4
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 +16 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +1 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +3 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +1 -1
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +5 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.test.js +540 -0
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +9 -5
- package/es/lib/SASQLookupComponent/TableBody/TableBody.test.js +253 -0
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +33 -0
- package/es/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +24 -0
- package/es/lib/SASQLookupComponent/__mocks__/index.js +20 -0
- package/es/lib/SASQRoute/SASQRoute.test.js +267 -0
- package/es/lib/SASQViewComponent/SASQViewComponent.test.js +104 -0
- package/es/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +19 -0
- package/es/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +19 -0
- package/es/lib/SASQViewComponent/__mocks__/index.js +20 -0
- package/es/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +1 -1
- package/package.json +5 -1
- package/src/artifacts/coverage-jest/ActionList/ActionList.js.html +4 -4
- package/src/artifacts/coverage-jest/ActionList/ActionListFieldArray.js.html +10 -10
- package/src/artifacts/coverage-jest/ActionList/index.html +1 -1
- package/src/artifacts/coverage-jest/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/ButtonTypedown.js.html +3 -3
- package/src/artifacts/coverage-jest/ButtonTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/ButtonTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/ComboButton.js.html +3 -3
- package/src/artifacts/coverage-jest/ComboButton/index.html +1 -1
- package/src/artifacts/coverage-jest/ComboButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesLookup.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertiesSettings.js.html +6 -6
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyForm.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Config/CustomPropertyView.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Config/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEdit.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertiesListField.js.html +5 -5
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyField.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/CustomPropertyFormCard.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Edit/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilter.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterField.js.html +7 -4
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/CustomPropertiesRule.js.html +11 -5
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useOperators.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useParseActiveFilterStrings.js.html +2 -2
- package/src/artifacts/coverage-jest/CustomProperties/Filter/useValueProps.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesView.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertiesViewCtx.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/CustomPropertyCard.js.html +3 -3
- package/src/artifacts/coverage-jest/CustomProperties/View/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/View/testResources.js.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/CustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/CycleButton.js.html +3 -3
- package/src/artifacts/coverage-jest/CycleButton/index.html +1 -1
- package/src/artifacts/coverage-jest/CycleButton/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/FieldLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/FieldLabel/index.html +1 -1
- package/src/artifacts/coverage-jest/FieldLabel/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/FormModal.js.html +3 -3
- package/src/artifacts/coverage-jest/FormModal/index.html +1 -1
- package/src/artifacts/coverage-jest/FormModal/index.js.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/FormattedKintMessage.js.html +3 -3
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/FormattedKintMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/IconSelect.js.html +3 -3
- package/src/artifacts/coverage-jest/IconSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/IconSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/NoResultsMessage.js.html +3 -3
- package/src/artifacts/coverage-jest/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/NumberField.js.html +3 -3
- package/src/artifacts/coverage-jest/NumberField/index.html +1 -1
- package/src/artifacts/coverage-jest/NumberField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/QueryTypedown.js.html +3 -3
- package/src/artifacts/coverage-jest/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/RefdataButtons.js.html +3 -3
- package/src/artifacts/coverage-jest/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/ResponsiveButtonGroup.js.html +30 -15
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.html +15 -15
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/index.js.html +1 -1
- package/src/artifacts/coverage-jest/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js.html +2 -2
- package/src/artifacts/coverage-jest/RichSelect/RichSelect.js.html +3 -3
- package/src/artifacts/coverage-jest/RichSelect/index.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/index.js.html +1 -1
- package/src/artifacts/coverage-jest/RichSelect/useSelectedOption.js.html +2 -2
- package/src/artifacts/coverage-jest/SASQLookupComponent/SASQLookupComponent.js.html +146 -149
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/TableBody.js.html +74 -65
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQLookupComponent/TableBody/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQRoute/SASQRoute.js.html +43 -43
- package/src/artifacts/coverage-jest/SASQRoute/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SASQViewComponent/SASQViewComponent.js.html +42 -42
- package/src/artifacts/coverage-jest/SASQViewComponent/index.html +21 -21
- package/src/artifacts/coverage-jest/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/SearchField.js.html +4 -4
- package/src/artifacts/coverage-jest/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/SearchKeyControl.js.html +3 -3
- package/src/artifacts/coverage-jest/SearchKeyControl/index.html +1 -1
- package/src/artifacts/coverage-jest/SearchKeyControl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +4 -4
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataCategoryList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/EditableRefdataList.js.html +4 -4
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsList.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js.html +5 -5
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/EditableSettingsListFieldArray/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/EditSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/RenderSettingValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/SettingField.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/RefdataCategoriesSettings.js.html +4 -4
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/RefdataCategoriesSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPage.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/SettingPagePane.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/SettingPagePane/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/SettingsFormContainer.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/SettingsFormContainer/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsField.js.html +3 -3
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/StaticSettingsFieldComponent.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/StaticSettingsFieldComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/StaticSettingsField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/constants/queryKeys.js.html +5 -5
- package/src/artifacts/coverage-jest/Settings/contexts/SettingsContext.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingCallout/useSettingCallout.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/staticSettingsPages/useStaticSettingsSection.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useAppSettings/useAppSettings.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettingSection/useSettingSection.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Settings/hooks/useSettings/useSettings.js.html +2 -2
- package/src/artifacts/coverage-jest/Settings/index.html +1 -1
- package/src/artifacts/coverage-jest/Settings/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/Tags.js.html +3 -3
- package/src/artifacts/coverage-jest/Tags/hooks/index.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/hooks/useTags.js.html +2 -2
- package/src/artifacts/coverage-jest/Tags/hooks/useTagsEnabled.js.html +8 -8
- package/src/artifacts/coverage-jest/Tags/index.html +1 -1
- package/src/artifacts/coverage-jest/Tags/index.js.html +1 -1
- package/src/artifacts/coverage-jest/Tags/tagsConfig.js.html +5 -5
- package/src/artifacts/coverage-jest/Typedown/Typedown.js.html +3 -3
- package/src/artifacts/coverage-jest/Typedown/index.html +1 -1
- package/src/artifacts/coverage-jest/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/cobertura-coverage.xml +712 -702
- package/src/artifacts/coverage-jest/constants/comparators.js.html +1 -1
- package/src/artifacts/coverage-jest/constants/customProperties.js.html +12 -12
- package/src/artifacts/coverage-jest/constants/endpoints.js.html +4 -4
- package/src/artifacts/coverage-jest/constants/eventCodes.js.html +4 -4
- package/src/artifacts/coverage-jest/constants/index.html +1 -1
- package/src/artifacts/coverage-jest/constants/pagination.js.html +6 -6
- package/src/artifacts/coverage-jest/hooks/index.html +51 -51
- package/src/artifacts/coverage-jest/hooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKey/useIntlKey.js.html +8 -8
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js.html +12 -12
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/intlHooks/useKintIntl/useKintIntl.js.html +10 -10
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedown.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownData.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/typedownHooks/useTypedownToggle.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useActionListRef.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useActiveElement.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useCustomProperties.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useHelperApp.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useInvalidateRefdata/useInvalidateRefdata.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useKiwtFieldArray.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useKiwtSASQuery.js.html +48 -48
- package/src/artifacts/coverage-jest/hooks/useLocalPageStore.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useLocalStorageState.js.html +22 -22
- package/src/artifacts/coverage-jest/hooks/useModConfigEntries.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateCustomProperties/useMutateCustomProperties.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/index.js.html +5 -2
- package/src/artifacts/coverage-jest/hooks/useMutateGeneric/useMutateGeneric.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateModConfigEntry.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useMutateRefdataValue/useMutateRefdataValue.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/usePrevNextPagination.js.html +68 -68
- package/src/artifacts/coverage-jest/hooks/useQIndex.js.html +28 -28
- package/src/artifacts/coverage-jest/hooks/useRefdata.js.html +3 -3
- package/src/artifacts/coverage-jest/hooks/useSASQQueryMeta.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/index.js.html +1 -1
- package/src/artifacts/coverage-jest/hooks/useStandaloneSASQQueryParameter/useStandaloneSASQQueryParameter.js.html +2 -2
- package/src/artifacts/coverage-jest/hooks/useTemplates.js.html +2 -2
- package/src/artifacts/coverage-jest/index.html +91 -91
- package/src/artifacts/coverage-jest/utils/buildUrl.js.html +34 -34
- package/src/artifacts/coverage-jest/utils/filterParsers/deparseKiwtQueryFilters.js.html +3 -3
- package/src/artifacts/coverage-jest/utils/filterParsers/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryFilters.js.html +3 -3
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryGroups.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/filterParsers/parseKiwtQueryString.js.html +5 -5
- package/src/artifacts/coverage-jest/utils/generateKiwtQuery.js.html +7 -7
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/generateKiwtQueryParams.js.html +67 -67
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.html +21 -21
- package/src/artifacts/coverage-jest/utils/generateKiwtQueryParams/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/groupCustomPropertiesByCtx.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/highlightString.js.html +3 -3
- package/src/artifacts/coverage-jest/utils/index.html +22 -22
- package/src/artifacts/coverage-jest/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/matchString.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/modConfigEntriesQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/parseErrorResponse.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/parseModConfigEntry.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/index.js.html +1 -1
- package/src/artifacts/coverage-jest/utils/refdataQueryKey/refdataQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/selectorSafe.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/sortByLabel.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/toCamelCase.js.html +2 -2
- package/src/artifacts/coverage-jest/utils/typedownQueryKey.js.html +2 -2
- package/src/artifacts/coverage-jest/validators/index.html +1 -1
- package/src/artifacts/coverage-jest/validators/index.js.html +1 -1
- package/src/artifacts/coverage-jest/validators/validators.js.html +8 -8
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +1 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +2 -0
- package/src/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +7 -2
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +3 -4
- package/src/lib/SASQLookupComponent/SASQLookupComponent.test.js +495 -0
- package/src/lib/SASQLookupComponent/TableBody/TableBody.js +6 -3
- package/src/lib/SASQLookupComponent/TableBody/TableBody.test.js +247 -0
- package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponent.js +31 -0
- package/src/lib/SASQLookupComponent/__mocks__/SASQLookupComponentRender.js +20 -0
- package/src/lib/SASQLookupComponent/__mocks__/index.js +2 -0
- package/src/lib/SASQRoute/SASQRoute.test.js +281 -0
- package/src/lib/SASQViewComponent/SASQViewComponent.test.js +114 -0
- package/src/lib/SASQViewComponent/__mocks__/SASQViewComponent.js +13 -0
- package/src/lib/SASQViewComponent/__mocks__/SASQViewComponentRender.js +17 -0
- package/src/lib/SASQViewComponent/__mocks__/index.js +2 -0
- package/src/lib/Settings/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +1 -1
- package/src/lib/hooks/useMutateGeneric/index.js +1 -1
- package/test/helpers/test-implementor-translations.json +2 -1
- package/test/helpers/translationsProperties.js +1 -1
- package/test/jest/setupTests.js +1 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { MemoryRouter, Route } from 'react-router-dom';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MultiColumnList,
|
|
5
|
+
MultiColumnListCell,
|
|
6
|
+
MultiColumnListHeader,
|
|
7
|
+
MultiColumnListRow,
|
|
8
|
+
} from '@folio/stripes-erm-testing';
|
|
9
|
+
import { renderWithKintHarness } from '../../../../test/jest';
|
|
10
|
+
|
|
11
|
+
import TableBody from './TableBody';
|
|
12
|
+
|
|
13
|
+
const mockHistoryPush = jest.fn();
|
|
14
|
+
|
|
15
|
+
// We want to use the ACTUAL location, but to mock history push so we can inspect it
|
|
16
|
+
jest.mock('react-router-dom', () => {
|
|
17
|
+
return ({
|
|
18
|
+
...jest.requireActual('react-router-dom'),
|
|
19
|
+
useHistory: () => ({ push: mockHistoryPush })
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const mockFetchNextPage = jest.fn();
|
|
24
|
+
const mockToggleFilterPane = jest.fn();
|
|
25
|
+
const mockOnSort = jest.fn();
|
|
26
|
+
|
|
27
|
+
const nameFormatterMock = jest.fn((item) => item.name);
|
|
28
|
+
|
|
29
|
+
const defaultMCLProps = {
|
|
30
|
+
formatter: {
|
|
31
|
+
name: (item) => item.name || '',
|
|
32
|
+
status: (item) => item.status?.label || '',
|
|
33
|
+
description: (item) => item.description || ''
|
|
34
|
+
},
|
|
35
|
+
columnWidths: { description: 500 },
|
|
36
|
+
interactive: true,
|
|
37
|
+
id: 'list-test-items',
|
|
38
|
+
autosize: false,
|
|
39
|
+
virtualize: false
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const resultColumns = [
|
|
43
|
+
{ propertyPath: 'name', label: 'Name' },
|
|
44
|
+
{ propertyPath: 'status', label: 'Status' },
|
|
45
|
+
{ propertyPath: 'description', label: 'Description' }
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const mockData = {
|
|
49
|
+
results: [
|
|
50
|
+
{
|
|
51
|
+
id: 'test-item-1',
|
|
52
|
+
name: 'Test Item 1',
|
|
53
|
+
description: 'Description 1',
|
|
54
|
+
status: { id: 'status-active', value: 'active', label: 'Active' },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'test-item-2',
|
|
58
|
+
name: 'AAAAA',
|
|
59
|
+
description: 'Description 2',
|
|
60
|
+
status: { id: 'status-closed', value: 'closed', label: 'Closed' },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'test-item-3',
|
|
64
|
+
name: 'ZZZZZ',
|
|
65
|
+
description: 'Description 3',
|
|
66
|
+
status: { id: 'status-draft', value: 'draft', label: 'Draft' },
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
totalRecords: 3
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
describe('TableBody', () => {
|
|
73
|
+
describe.each([
|
|
74
|
+
{
|
|
75
|
+
label: 'default path',
|
|
76
|
+
initialEntries: ['/test/items'],
|
|
77
|
+
expectedSortOrder: 'Name',
|
|
78
|
+
expectedSortDirection: 'none',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: 'with search params',
|
|
82
|
+
initialEntries: ['/test/items?testquery=123'],
|
|
83
|
+
expectedSortOrder: 'Name',
|
|
84
|
+
expectedSortDirection: 'none',
|
|
85
|
+
expectedPushQuery: '?testquery=123'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
label: 'with query sort descending',
|
|
89
|
+
initialEntries: ['/test/items'],
|
|
90
|
+
query: { sort: '-status' },
|
|
91
|
+
expectedSortOrder: 'Status',
|
|
92
|
+
expectedSortDirection: 'descending',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: 'selected row',
|
|
96
|
+
initialEntries: ['/test/items/test-item-2'],
|
|
97
|
+
selectedRowIndex: 1,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'enhanced formatter check',
|
|
101
|
+
initialEntries: ['/test/items'],
|
|
102
|
+
mclProps: {
|
|
103
|
+
...defaultMCLProps,
|
|
104
|
+
formatter: {
|
|
105
|
+
...defaultMCLProps.formatter,
|
|
106
|
+
name: nameFormatterMock
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
checkEnhancedFormatter: true
|
|
110
|
+
}
|
|
111
|
+
])('Testing $label', ({
|
|
112
|
+
checkEnhancedFormatter,
|
|
113
|
+
expectedPushQuery = '',
|
|
114
|
+
expectedSortDirection,
|
|
115
|
+
expectedSortOrder,
|
|
116
|
+
initialEntries,
|
|
117
|
+
mclProps = defaultMCLProps,
|
|
118
|
+
query = {},
|
|
119
|
+
selectedRowIndex
|
|
120
|
+
}) => {
|
|
121
|
+
beforeEach(() => {
|
|
122
|
+
renderWithKintHarness(
|
|
123
|
+
<MemoryRouter initialEntries={initialEntries}>
|
|
124
|
+
<Route
|
|
125
|
+
path="/test/items/:id?"
|
|
126
|
+
render={(routeProps) => (
|
|
127
|
+
<TableBody
|
|
128
|
+
{...routeProps}
|
|
129
|
+
data={mockData}
|
|
130
|
+
fetchNextPage={mockFetchNextPage}
|
|
131
|
+
filterPaneVisible={false}
|
|
132
|
+
intlKey="stripes-kint-components"
|
|
133
|
+
isError={false}
|
|
134
|
+
isLoading={false}
|
|
135
|
+
mclProps={mclProps}
|
|
136
|
+
onSort={mockOnSort}
|
|
137
|
+
path="/test/items"
|
|
138
|
+
query={query}
|
|
139
|
+
resultColumns={resultColumns}
|
|
140
|
+
rowNavigation
|
|
141
|
+
toggleFilterPane={mockToggleFilterPane}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
/>
|
|
145
|
+
</MemoryRouter>,
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('renders the expected number of columns', async () => {
|
|
150
|
+
await MultiColumnList({ columnCount: 3 }).exists();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test('renders the expected number of rows', async () => {
|
|
154
|
+
await MultiColumnList({ rowCount: 3 }).exists();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (expectedSortOrder) {
|
|
158
|
+
test(`renders ${expectedSortOrder} header with ${expectedSortDirection} sort`, async () => {
|
|
159
|
+
await MultiColumnListHeader(expectedSortOrder).has({ sort: expectedSortDirection });
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (selectedRowIndex !== undefined) {
|
|
164
|
+
test(`row ${selectedRowIndex} is selected`, async () => {
|
|
165
|
+
await MultiColumnListRow({ index: selectedRowIndex }).has({ selected: ['mclSelected'] });
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test(`row ${selectedRowIndex - 1} is not selected`, async () => {
|
|
169
|
+
await MultiColumnListRow({ index: selectedRowIndex - 1 }).has({ selected: null });
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
describe('TableBody content rendering', () => {
|
|
174
|
+
describe.each([0, 1, 2])('rendering row %s', (index) => {
|
|
175
|
+
describe.each([
|
|
176
|
+
{
|
|
177
|
+
property: 'name',
|
|
178
|
+
col: 0
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
property: 'status',
|
|
182
|
+
col: 1,
|
|
183
|
+
hasLabel: true
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
property: 'description',
|
|
187
|
+
col: 2
|
|
188
|
+
},
|
|
189
|
+
])('rendering column: $col, property: $property', (({ property, col, hasLabel }) => {
|
|
190
|
+
const expectedValue = hasLabel ? mockData.results[index][property].label : mockData.results[index][property];
|
|
191
|
+
|
|
192
|
+
test(`renders expected ${property} content: ${expectedValue}`, async () => {
|
|
193
|
+
await MultiColumnListCell({ row: index, columnIndex: col }).has({ content: expectedValue });
|
|
194
|
+
});
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
describe('clicking table header', () => {
|
|
200
|
+
beforeEach(async () => {
|
|
201
|
+
mockOnSort.mockClear();
|
|
202
|
+
await MultiColumnListHeader('Name').click();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('onSort callback is called', async () => {
|
|
206
|
+
expect(mockOnSort).toHaveBeenCalled();
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
if (checkEnhancedFormatter) {
|
|
211
|
+
describe('enhanced formatter logic', () => {
|
|
212
|
+
test('name formatter receives defaultRowUrl', async () => {
|
|
213
|
+
// Verify that the formatter function was called with the injected defaultRowUrl object
|
|
214
|
+
expect(nameFormatterMock).toHaveBeenCalledWith(
|
|
215
|
+
expect.objectContaining({
|
|
216
|
+
defaultRowUrl: expect.objectContaining({
|
|
217
|
+
baseUrl: '/test/items/test-item-1',
|
|
218
|
+
path: '/test/items'
|
|
219
|
+
})
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test('name formatter receives expected item', async () => {
|
|
225
|
+
// Verify that the formatter function was called with the injected item object
|
|
226
|
+
expect(nameFormatterMock).toHaveBeenCalledWith(
|
|
227
|
+
expect.objectContaining(mockData.results[0])
|
|
228
|
+
);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
describe('clicking a row', () => {
|
|
234
|
+
const targetRow = 0;
|
|
235
|
+
const expectedId = mockData.results[targetRow].id;
|
|
236
|
+
|
|
237
|
+
beforeEach(async () => {
|
|
238
|
+
mockHistoryPush.mockClear();
|
|
239
|
+
await MultiColumnListCell({ row: targetRow, columnIndex: 0 }).click();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test(`useHistory called with expected path to ${expectedId}`, () => {
|
|
243
|
+
expect(mockHistoryPush).toHaveBeenCalledWith(`/test/items/${expectedId}${expectedPushQuery}`);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import noop from 'lodash/noop';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@folio/stripes/components';
|
|
5
|
+
|
|
6
|
+
import SASQLookupComponentRender from './SASQLookupComponentRender';
|
|
7
|
+
|
|
8
|
+
const SASQLookupComponent = forwardRef(({
|
|
9
|
+
children,
|
|
10
|
+
fetchParameters,
|
|
11
|
+
testFetchParametersOnClick = noop
|
|
12
|
+
}, ref) => {
|
|
13
|
+
// Use useImperativeHandle to expose a mock object
|
|
14
|
+
useImperativeHandle(ref, () => ({
|
|
15
|
+
// This is the object the ref will point to
|
|
16
|
+
lookupRefData: 'mocked lookup data',
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Button onClick={() => testFetchParametersOnClick(fetchParameters)}>
|
|
22
|
+
Test fetchParameters
|
|
23
|
+
</Button>
|
|
24
|
+
<SASQLookupComponentRender>
|
|
25
|
+
{children}
|
|
26
|
+
</SASQLookupComponentRender>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default SASQLookupComponent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// We deal with the render part separately to the forwardRef part so that we might mock them separately as well
|
|
2
|
+
// Store the original implementation so we can restore it with a single call on the mock
|
|
3
|
+
const originalRenderImplementation = ({ children }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div>
|
|
6
|
+
<div>
|
|
7
|
+
SASQLookupComponent
|
|
8
|
+
</div>
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const SASQLookupComponentRender = jest.fn(originalRenderImplementation);
|
|
15
|
+
|
|
16
|
+
SASQLookupComponentRender.mockResetToDefault = () => {
|
|
17
|
+
SASQLookupComponentRender.mockImplementation(originalRenderImplementation);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default SASQLookupComponentRender;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
import { MemoryRouter, Route, Switch } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { /* screen, */ waitFor } from '@folio/jest-config-stripes/testing-library/react';
|
|
5
|
+
|
|
6
|
+
import { Button as StripesButton } from '@folio/stripes/components';
|
|
7
|
+
import { Button } from '@folio/stripes-erm-testing';
|
|
8
|
+
|
|
9
|
+
import { renderWithKintHarness } from '../../../test/jest';
|
|
10
|
+
import SASQRoute from './SASQRoute';
|
|
11
|
+
|
|
12
|
+
// We can import these special render-mocks once we manually mock the modules
|
|
13
|
+
import { SASQLookupComponent, SASQLookupComponentRender } from '../SASQLookupComponent';
|
|
14
|
+
import { SASQViewComponentRender } from '../SASQViewComponent';
|
|
15
|
+
|
|
16
|
+
// Using Manual mocks
|
|
17
|
+
jest.mock('../SASQLookupComponent');
|
|
18
|
+
jest.mock('../SASQViewComponent');
|
|
19
|
+
|
|
20
|
+
const testFetchParametersOnClick = jest.fn();
|
|
21
|
+
|
|
22
|
+
let theRef;
|
|
23
|
+
describe('SASQRoute', () => {
|
|
24
|
+
describe.each([
|
|
25
|
+
{
|
|
26
|
+
testLabel: 'default behaviour on path /testPath',
|
|
27
|
+
props: {
|
|
28
|
+
fetchParameters: {
|
|
29
|
+
SASQ_MAP: {}
|
|
30
|
+
},
|
|
31
|
+
path: '/testPath'
|
|
32
|
+
},
|
|
33
|
+
expectedPath: '/testPath',
|
|
34
|
+
expectedViewPath: '/testPath/testId',
|
|
35
|
+
expectedFetchParameters: {
|
|
36
|
+
SASQ_MAP: {
|
|
37
|
+
perPage: 25,
|
|
38
|
+
stats: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
42
|
+
viewComponentText: 'SASQViewComponent',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
testLabel: 'with passed getPathLookup and getPathView',
|
|
46
|
+
props: {
|
|
47
|
+
fetchParameters: {
|
|
48
|
+
SASQ_MAP: {}
|
|
49
|
+
},
|
|
50
|
+
getPathLookup: () => '/wibble/:id?',
|
|
51
|
+
getPathView: () => '/wibble/extra-param/:id',
|
|
52
|
+
// path: '/testPath' // FIXME it turns out if you pass a path in then that gets used by parent Switch
|
|
53
|
+
// In addition one can't easily set just the view path since it needs to be rendered within the lookup path...
|
|
54
|
+
// not the most helpful props to be honest -- see ILL SharedIndexRoute for the current only usage
|
|
55
|
+
},
|
|
56
|
+
expectedPath: '/wibble',
|
|
57
|
+
expectedViewPath: '/wibble/extra-param/testId',
|
|
58
|
+
expectedFetchParameters: {
|
|
59
|
+
SASQ_MAP: {
|
|
60
|
+
perPage: 25,
|
|
61
|
+
stats: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
65
|
+
viewComponentText: 'SASQViewComponent',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
testLabel: 'with passed SASQLookupComponent',
|
|
69
|
+
props: {
|
|
70
|
+
fetchParameters: {
|
|
71
|
+
SASQ_MAP: {}
|
|
72
|
+
},
|
|
73
|
+
path: '/testPath'
|
|
74
|
+
},
|
|
75
|
+
expectedPath: '/testPath',
|
|
76
|
+
expectedViewPath: '/testPath/testId',
|
|
77
|
+
expectedFetchParameters: {
|
|
78
|
+
SASQ_MAP: {
|
|
79
|
+
perPage: 25,
|
|
80
|
+
stats: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
lookupComponentText: 'Special Test Lookup Component',
|
|
84
|
+
viewComponentText: 'SASQViewComponent',
|
|
85
|
+
mockLookupComponent: ({ children }) => (
|
|
86
|
+
<div>
|
|
87
|
+
<div>
|
|
88
|
+
Special Test Lookup Component
|
|
89
|
+
</div>
|
|
90
|
+
{children}
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
testLabel: 'with passed SASQViewComponent',
|
|
96
|
+
props: {
|
|
97
|
+
fetchParameters: {
|
|
98
|
+
SASQ_MAP: {}
|
|
99
|
+
},
|
|
100
|
+
path: '/testPath'
|
|
101
|
+
},
|
|
102
|
+
expectedPath: '/testPath',
|
|
103
|
+
expectedViewPath: '/testPath/testId',
|
|
104
|
+
expectedFetchParameters: {
|
|
105
|
+
SASQ_MAP: {
|
|
106
|
+
perPage: 25,
|
|
107
|
+
stats: true
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
111
|
+
viewComponentText: 'Special Test View Component',
|
|
112
|
+
mockViewComponent: () => (
|
|
113
|
+
<div>
|
|
114
|
+
Special Test View Component
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
testLabel: 'with passed fetchParameters',
|
|
120
|
+
props: {
|
|
121
|
+
fetchParameters: {
|
|
122
|
+
wibble: 3, // Test that fetchParams don't get lost
|
|
123
|
+
SASQ_MAP: {
|
|
124
|
+
wobble: 'igneous', // Test that fetchParams.SASQ_MAP params don't get lost
|
|
125
|
+
perPage: 20, // Test that fetchParams.SASQ_MAP.perPage is only defaulted, not overridden
|
|
126
|
+
stats: false // This tests that stats gets overridden
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
path: '/testPath'
|
|
130
|
+
},
|
|
131
|
+
expectedPath: '/testPath',
|
|
132
|
+
expectedViewPath: '/testPath/testId',
|
|
133
|
+
expectedFetchParameters: {
|
|
134
|
+
wibble: 3,
|
|
135
|
+
SASQ_MAP: {
|
|
136
|
+
wobble: 'igneous',
|
|
137
|
+
perPage: 20,
|
|
138
|
+
stats: true
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
lookupComponentText: 'SASQLookupComponent',
|
|
142
|
+
viewComponentText: 'SASQViewComponent',
|
|
143
|
+
},
|
|
144
|
+
])('Testing $testLabel', ({
|
|
145
|
+
expectedPath,
|
|
146
|
+
expectedViewPath,
|
|
147
|
+
expectedFetchParameters,
|
|
148
|
+
props,
|
|
149
|
+
lookupComponentText,
|
|
150
|
+
viewComponentText,
|
|
151
|
+
mockLookupComponent,
|
|
152
|
+
mockViewComponent
|
|
153
|
+
}) => {
|
|
154
|
+
let renderComponent;
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
testFetchParametersOnClick.mockClear();
|
|
157
|
+
|
|
158
|
+
// Set up a ref we can pass around -- new per test (block)
|
|
159
|
+
theRef = createRef();
|
|
160
|
+
|
|
161
|
+
// EXAMPLE we set up a special "mockResetToDefault" on the manual mock objects specifically
|
|
162
|
+
// to return to the original implementation
|
|
163
|
+
// We could potentially have used jest spyOn and restore, but this already took me too long to figure out...
|
|
164
|
+
if (mockLookupComponent) {
|
|
165
|
+
SASQLookupComponentRender.mockImplementation(mockLookupComponent);
|
|
166
|
+
} else {
|
|
167
|
+
SASQLookupComponentRender.mockResetToDefault();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (mockViewComponent) {
|
|
171
|
+
SASQViewComponentRender.mockImplementation(mockViewComponent);
|
|
172
|
+
} else {
|
|
173
|
+
SASQViewComponentRender.mockResetToDefault();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
renderComponent = renderWithKintHarness(
|
|
177
|
+
<MemoryRouter initialEntries={['/hello']}>
|
|
178
|
+
<StripesButton to={expectedPath}>
|
|
179
|
+
SASQRouteButton
|
|
180
|
+
</StripesButton>
|
|
181
|
+
<StripesButton to={expectedViewPath}>
|
|
182
|
+
SASQViewButton
|
|
183
|
+
</StripesButton>
|
|
184
|
+
{/* Extra helper route to grab MemoryRouter location */}
|
|
185
|
+
{/* <Route
|
|
186
|
+
path="/:any?"
|
|
187
|
+
>
|
|
188
|
+
{({ location }) => {
|
|
189
|
+
console.log('location', location);
|
|
190
|
+
return null
|
|
191
|
+
}}
|
|
192
|
+
</Route> */}
|
|
193
|
+
<Switch>
|
|
194
|
+
<Route path="/hello">
|
|
195
|
+
Hello world
|
|
196
|
+
</Route>
|
|
197
|
+
<SASQRoute
|
|
198
|
+
ref={theRef}
|
|
199
|
+
// Allow for testing of fetch parameters
|
|
200
|
+
testFetchParametersOnClick={testFetchParametersOnClick}
|
|
201
|
+
{...props}
|
|
202
|
+
/>
|
|
203
|
+
</Switch>
|
|
204
|
+
</MemoryRouter>
|
|
205
|
+
);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test('does not render SASQRoute on /hello', () => {
|
|
209
|
+
const { queryByText } = renderComponent;
|
|
210
|
+
expect(queryByText(lookupComponentText)).not.toBeInTheDocument();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('renders hello world text', () => {
|
|
214
|
+
const { getByText } = renderComponent;
|
|
215
|
+
expect(getByText('Hello world')).toBeInTheDocument();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test('ref is unset', () => {
|
|
219
|
+
expect(theRef.current).toEqual(null);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe(`navigating to ${expectedPath}`, () => {
|
|
223
|
+
beforeEach(async () => {
|
|
224
|
+
await waitFor(async () => {
|
|
225
|
+
await Button('SASQRouteButton').click();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('no longer renders hello world text', () => {
|
|
230
|
+
const { queryByText } = renderComponent;
|
|
231
|
+
expect(queryByText('Hello world')).not.toBeInTheDocument();
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test(`renders SASQRoute lookup component on ${expectedPath}`, () => {
|
|
235
|
+
const { getByText } = renderComponent;
|
|
236
|
+
expect(getByText(lookupComponentText)).toBeInTheDocument();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test(`does not render SASQRoute view component on ${expectedPath}`, () => {
|
|
240
|
+
const { queryByText } = renderComponent;
|
|
241
|
+
expect(queryByText(viewComponentText)).not.toBeInTheDocument();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test('ref has gained lookup component ref data', () => {
|
|
245
|
+
expect(theRef.current).toEqual({ lookupRefData: 'mocked lookup data' });
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe('testing fetchParameters', () => {
|
|
249
|
+
beforeEach(async () => {
|
|
250
|
+
await waitFor(async () => {
|
|
251
|
+
await Button('Test fetchParameters').click();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test('testFetchParametersOnClick was called with expected values', () => {
|
|
256
|
+
expect(testFetchParametersOnClick).toHaveBeenCalledWith(expectedFetchParameters);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
describe(`navigating to ${expectedViewPath}`, () => {
|
|
261
|
+
beforeEach(async () => {
|
|
262
|
+
await waitFor(async () => {
|
|
263
|
+
await Button('SASQViewButton').click();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test(`renders SASQRoute view component on ${expectedViewPath}`, () => {
|
|
268
|
+
const { getByText } = renderComponent;
|
|
269
|
+
expect(getByText(viewComponentText)).toBeInTheDocument();
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('ref has gained view component ref data', () => {
|
|
273
|
+
expect(theRef.current).toEqual({
|
|
274
|
+
lookupRefData: 'mocked lookup data',
|
|
275
|
+
viewRefData: 'mocked view data',
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
import { MemoryRouter, Route } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { waitFor } from '@folio/jest-config-stripes/testing-library/react';
|
|
5
|
+
import { Button } from '@folio/stripes-erm-testing';
|
|
6
|
+
|
|
7
|
+
import { renderWithKintHarness } from '../../../test/jest';
|
|
8
|
+
import SASQViewComponent from './SASQViewComponent';
|
|
9
|
+
|
|
10
|
+
export const ViewComponentRender = jest.fn();
|
|
11
|
+
|
|
12
|
+
const MockViewComponent = jest.fn((props) => {
|
|
13
|
+
ViewComponentRender(props);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
SASQViewComponent
|
|
18
|
+
<button onClick={props.onClose} type="button">
|
|
19
|
+
Close
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('SASQViewComponent', () => {
|
|
26
|
+
let theRef;
|
|
27
|
+
let historyPush;
|
|
28
|
+
|
|
29
|
+
describe.each([
|
|
30
|
+
{
|
|
31
|
+
testLabel: 'default behaviour',
|
|
32
|
+
startingLocation: '/testPath/testId',
|
|
33
|
+
expectedPath: '/testPath',
|
|
34
|
+
expectedSearch: '',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
testLabel: 'with query params',
|
|
38
|
+
startingLocation: '/testPath/testId?filters=test&page=1',
|
|
39
|
+
expectedPath: '/testPath',
|
|
40
|
+
expectedSearch: '?filters=test&page=1',
|
|
41
|
+
},
|
|
42
|
+
])(
|
|
43
|
+
'Testing $testLabel',
|
|
44
|
+
({ startingLocation, expectedPath, expectedSearch }) => {
|
|
45
|
+
let renderResult;
|
|
46
|
+
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
ViewComponentRender.mockClear();
|
|
49
|
+
MockViewComponent.mockClear();
|
|
50
|
+
|
|
51
|
+
historyPush = jest.fn();
|
|
52
|
+
theRef = createRef();
|
|
53
|
+
|
|
54
|
+
renderResult = renderWithKintHarness(
|
|
55
|
+
<MemoryRouter initialEntries={[startingLocation]}>
|
|
56
|
+
<Route
|
|
57
|
+
path="/testPath/:id"
|
|
58
|
+
render={(routeProps) => (
|
|
59
|
+
<SASQViewComponent
|
|
60
|
+
{...routeProps}
|
|
61
|
+
ref={theRef}
|
|
62
|
+
fetchParameters={{
|
|
63
|
+
endpoint: '/test',
|
|
64
|
+
itemEndpoint: '/test',
|
|
65
|
+
}}
|
|
66
|
+
history={{ push: historyPush }}
|
|
67
|
+
id="sasq-test"
|
|
68
|
+
path="/testPath"
|
|
69
|
+
ViewComponent={MockViewComponent}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
/>
|
|
73
|
+
</MemoryRouter>
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('renders the view component', async () => {
|
|
78
|
+
const { getByText } = renderResult;
|
|
79
|
+
|
|
80
|
+
await waitFor(() => {
|
|
81
|
+
expect(getByText('SASQViewComponent')).toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('calls the ViewComponent', async () => {
|
|
86
|
+
await waitFor(() => {
|
|
87
|
+
expect(ViewComponentRender).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('onClose navigates back to list path', async () => {
|
|
92
|
+
await waitFor(async () => {
|
|
93
|
+
await Button('Close').click();
|
|
94
|
+
});
|
|
95
|
+
expect(historyPush).toHaveBeenCalledWith(`${expectedPath}${expectedSearch}`);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('ref exposes onClose function', async () => {
|
|
99
|
+
await waitFor(() => {
|
|
100
|
+
expect(theRef.current).toBeTruthy();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('ref exposes queryProps', async () => {
|
|
105
|
+
await waitFor(() => {
|
|
106
|
+
expect(theRef.current).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expect(theRef.current.queryProps).toBeDefined();
|
|
110
|
+
expect(theRef.current.queryProps.data).toBeDefined();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
});
|