@capillarytech/blaze-ui 5.23.3-beta.1 → 5.23.3-beta.10
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/CapActionBar/index.js +48 -81
- package/CapActionBar/styles.module.css +11 -0
- package/CapActionBar/styles.module.scss.js +6 -0
- package/CapActionBar/types.js +1 -1
- package/CapAdvancedIcon/index.js +216 -179
- package/CapAdvancedIcon/styles.module.css +124 -0
- package/CapAdvancedIcon/styles.module.scss.js +28 -0
- package/CapAdvancedIcon/styles.scss +23 -23
- package/CapAdvancedIcon/types.js +1 -1
- package/CapAlert/index.js +29 -34
- package/CapAlert/styles.module.css +35 -0
- package/CapAlert/styles.module.scss.js +6 -0
- package/CapAlert/styles.scss +1 -1
- package/CapAppNotEnabled/index.js +25 -43
- package/CapAppNotEnabled/styles.module.css +32 -0
- package/CapAppNotEnabled/styles.module.scss.js +14 -0
- package/CapAppNotEnabled/styles.scss +5 -5
- package/CapAppNotEnabled/types.js +1 -1
- package/CapAskAira/AudienceFilterBot/constants.js +4 -1
- package/CapAskAira/AudienceFilterBot/index.js +449 -405
- package/CapAskAira/AudienceFilterBot/messages.js +44 -40
- package/CapAskAira/AudienceFilterBot/styles.module.css +425 -0
- package/CapAskAira/AudienceFilterBot/styles.module.scss.js +76 -0
- package/CapAskAira/AudienceFilterBot/styles.scss +7 -7
- package/CapAskAira/AudienceFilterBot/types.js +1 -1
- package/CapAskAira/CapAiMediaGeneration/actions.js +7 -4
- package/CapAskAira/CapAiMediaGeneration/api.js +8 -5
- package/CapAskAira/CapAiMediaGeneration/constants.js +27 -11
- package/CapAskAira/CapAiMediaGeneration/index.js +263 -320
- package/CapAskAira/CapAiMediaGeneration/messages.js +32 -28
- package/CapAskAira/CapAiMediaGeneration/reducer.js +14 -18
- package/CapAskAira/CapAiMediaGeneration/saga.js +17 -12
- package/CapAskAira/CapAiMediaGeneration/selectors.js +12 -16
- package/CapAskAira/CapAiMediaGeneration/styles.module.css +174 -0
- package/CapAskAira/CapAiMediaGeneration/styles.module.scss.js +32 -0
- package/CapAskAira/CapAiMediaGeneration/styles.scss +14 -14
- package/CapAskAira/CapAiMediaGeneration/types.js +1 -1
- package/CapAskAira/ConfigurationBot/CopilotResponse.js +394 -402
- package/CapAskAira/ConfigurationBot/GeneratingResponse.js +60 -68
- package/CapAskAira/ConfigurationBot/IdentityIcon.js +27 -39
- package/CapAskAira/ConfigurationBot/PromptAttachmentButton.js +32 -39
- package/CapAskAira/ConfigurationBot/UserApproveAction.js +47 -58
- package/CapAskAira/ConfigurationBot/UserRequest.js +33 -36
- package/CapAskAira/ConfigurationBot/constants.js +50 -29
- package/CapAskAira/ConfigurationBot/index.js +361 -388
- package/CapAskAira/ConfigurationBot/inferenceGenerator.js +12 -15
- package/CapAskAira/ConfigurationBot/messages.js +41 -37
- package/CapAskAira/ConfigurationBot/styles.module.css +165 -0
- package/CapAskAira/ConfigurationBot/styles.module.scss.js +41 -0
- package/CapAskAira/ConfigurationBot/styles.scss +33 -33
- package/CapAskAira/ConfigurationBot/test/mockData.js +53 -44
- package/CapAskAira/ConfigurationBot/types.js +1 -1
- package/CapAskAira/ConfigurationBot/util.js +30 -34
- package/CapAskAira/ContentGenerationBot/UtilComponents.js +123 -148
- package/CapAskAira/ContentGenerationBot/constants.js +25 -12
- package/CapAskAira/ContentGenerationBot/index.js +164 -153
- package/CapAskAira/ContentGenerationBot/jsonAssembler.js +32 -70
- package/CapAskAira/ContentGenerationBot/messages.js +28 -24
- package/CapAskAira/ContentGenerationBot/styles.module.css +96 -0
- package/CapAskAira/ContentGenerationBot/styles.module.scss.js +20 -0
- package/CapAskAira/ContentGenerationBot/types.js +1 -1
- package/CapAskAira/DocumentationBot/UtilComponents.js +55 -57
- package/CapAskAira/DocumentationBot/constants.js +23 -11
- package/CapAskAira/DocumentationBot/index.js +134 -153
- package/CapAskAira/DocumentationBot/messages.js +27 -23
- package/CapAskAira/DocumentationBot/styles.module.css +91 -0
- package/CapAskAira/DocumentationBot/styles.module.scss.js +23 -0
- package/CapAskAira/DocumentationBot/types.js +1 -1
- package/CapAskAira/DocumentationChatBot/MetaBlock.js +74 -75
- package/CapAskAira/DocumentationChatBot/actions.js +11 -9
- package/CapAskAira/DocumentationChatBot/api.js +8 -5
- package/CapAskAira/DocumentationChatBot/constants.js +23 -11
- package/CapAskAira/DocumentationChatBot/index.js +193 -221
- package/CapAskAira/DocumentationChatBot/messages.js +18 -14
- package/CapAskAira/DocumentationChatBot/reducer.js +17 -22
- package/CapAskAira/DocumentationChatBot/saga.js +25 -31
- package/CapAskAira/DocumentationChatBot/selectors.js +12 -16
- package/CapAskAira/DocumentationChatBot/styles.module.css +77 -0
- package/CapAskAira/DocumentationChatBot/styles.module.scss.js +20 -0
- package/CapAskAira/DocumentationChatBot/styles.scss +7 -7
- package/CapAskAira/DocumentationChatBot/types.js +1 -1
- package/CapAskAira/RuleGenerationBot/UtilComponents.js +107 -114
- package/CapAskAira/RuleGenerationBot/actions.js +26 -23
- package/CapAskAira/RuleGenerationBot/api.js +16 -24
- package/CapAskAira/RuleGenerationBot/constants.js +37 -18
- package/CapAskAira/RuleGenerationBot/index.js +130 -160
- package/CapAskAira/RuleGenerationBot/messages.js +30 -26
- package/CapAskAira/RuleGenerationBot/reducer.js +28 -38
- package/CapAskAira/RuleGenerationBot/saga.js +75 -72
- package/CapAskAira/RuleGenerationBot/selector.js +12 -15
- package/CapAskAira/RuleGenerationBot/styles.module.css +33 -0
- package/CapAskAira/RuleGenerationBot/styles.module.scss.js +11 -0
- package/CapAskAira/RuleGenerationBot/types.js +1 -1
- package/CapAskAira/RuleSummarizationBot/MetaBlock.js +104 -108
- package/CapAskAira/RuleSummarizationBot/actions.js +36 -42
- package/CapAskAira/RuleSummarizationBot/api.js +28 -45
- package/CapAskAira/RuleSummarizationBot/constants.js +65 -32
- package/CapAskAira/RuleSummarizationBot/index.js +180 -240
- package/CapAskAira/RuleSummarizationBot/messages.js +30 -26
- package/CapAskAira/RuleSummarizationBot/reducer.js +47 -59
- package/CapAskAira/RuleSummarizationBot/saga.js +154 -138
- package/CapAskAira/RuleSummarizationBot/selector.js +12 -15
- package/CapAskAira/RuleSummarizationBot/styles.module.css +85 -0
- package/CapAskAira/RuleSummarizationBot/styles.module.scss.js +22 -0
- package/CapAskAira/RuleSummarizationBot/styles.scss +8 -8
- package/CapAskAira/RuleSummarizationBot/types.js +1 -1
- package/CapAskAira/UtilComponents/AiraContainer.js +99 -109
- package/CapAskAira/UtilComponents/AiraTooltip.js +12 -19
- package/CapAskAira/UtilComponents/ErrorBar.js +23 -25
- package/CapAskAira/UtilComponents/Icons.js +49 -52
- package/CapAskAira/UtilComponents/InputBox.js +53 -44
- package/CapAskAira/UtilComponents/MultiLineInpuxBox.js +85 -116
- package/CapAskAira/UtilComponents/Notification.js +18 -19
- package/CapAskAira/UtilComponents/Popup.js +113 -136
- package/CapAskAira/UtilComponents/SecondaryButton.js +18 -40
- package/CapAskAira/UtilComponents/TitleBar.js +42 -41
- package/CapAskAira/UtilComponents/Tooltip.js +16 -17
- package/CapAskAira/constants.js +25 -18
- package/CapAskAira/hooks/useWebsocket.js +38 -51
- package/CapAskAira/index.js +25 -16
- package/CapAskAira/reducer.js +13 -11
- package/CapAskAira/rootStyles.js +4 -2
- package/CapAskAira/selector.js +6 -3
- package/CapAskAira/styles.module.css +238 -0
- package/CapAskAira/styles.module.scss.js +39 -0
- package/CapAskAira/styles.scss +4 -4
- package/CapAskAira/util.js +42 -40
- package/CapBanner/index.js +22 -34
- package/CapBanner/styles.module.css +34 -0
- package/CapBanner/styles.module.scss.js +9 -0
- package/CapBanner/styles.scss +1 -1
- package/CapBanner/types.js +1 -1
- package/CapBlock/index.js +50 -62
- package/CapBlock/styles.module.css +41 -0
- package/CapBlock/styles.module.scss.js +8 -0
- package/CapBlock/styles.scss +1 -1
- package/CapBlock/types.js +1 -1
- package/CapBorderedBox/index.js +29 -34
- package/CapBorderedBox/types.js +1 -1
- package/CapButton/index.js +100 -135
- package/CapButton/styles.module.css +207 -0
- package/CapButton/styles.module.scss.js +13 -0
- package/CapButton/styles.scss +35 -35
- package/CapButton/types.js +1 -1
- package/CapCSVFileUploader/index.js +113 -123
- package/CapCSVFileUploader/styles.module.css +73 -0
- package/CapCSVFileUploader/styles.module.scss.js +21 -0
- package/CapCSVFileUploader/styles.scss +11 -11
- package/CapCSVFileUploader/types.js +1 -1
- package/CapCalendarDatePicker/index.js +11 -28
- package/CapCalendarDatePicker/styles.module.css +108 -0
- package/CapCalendarDatePicker/styles.module.scss.js +6 -0
- package/CapCalendarDatePicker/styles.scss +1 -1
- package/CapCalendarDatePicker/types.js +1 -1
- package/CapCard/index.js +10 -25
- package/CapCard/styles.module.css +21 -0
- package/CapCard/styles.module.scss.js +6 -0
- package/CapCard/styles.scss +1 -1
- package/CapCard/types.js +1 -1
- package/CapCardBox/index.js +44 -54
- package/CapCardBox/styles.module.css +43 -0
- package/CapCardBox/styles.module.scss.js +12 -0
- package/CapCardBox/styles.scss +7 -7
- package/CapCardBox/types.js +1 -1
- package/CapCarousel/index.js +78 -96
- package/CapCarousel/styles.module.css +25 -0
- package/CapCarousel/styles.module.scss.js +8 -0
- package/CapCarousel/types.js +1 -1
- package/CapCheckbox/index.js +33 -47
- package/CapCheckbox/styles.module.css +44 -0
- package/CapCheckbox/styles.module.scss.js +12 -0
- package/CapCheckbox/styles.scss +5 -5
- package/CapCheckbox/types.js +1 -1
- package/CapCollapsibleLeftNavigation/constants.js +30 -14
- package/CapCollapsibleLeftNavigation/index.js +23 -7
- package/CapCollapsibleLeftNavigation/reducer.js +15 -33
- package/CapCollapsibleLeftNavigation/saga.js +23 -46
- package/CapCollapsibleNavbar/constants.js +40 -19
- package/CapCollapsibleNavbar/index.js +575 -619
- package/CapCollapsibleNavbar/styles.css +296 -0
- package/CapCollapsibleNavbar/styles.scss +75 -75
- package/CapColorPicker/index.js +26 -28
- package/CapColorPicker/styles.module.css +23 -0
- package/CapColorPicker/styles.module.scss.js +7 -0
- package/CapColorPicker/styles.scss +2 -2
- package/CapColorPicker/types.js +1 -1
- package/CapColoredTag/index.js +42 -56
- package/CapColoredTag/styles.js +28 -11
- package/CapColoredTag/styles.module.css +27 -0
- package/CapColoredTag/styles.module.scss.js +10 -0
- package/CapColoredTag/styles.scss +2 -2
- package/CapColoredTag/types.js +1 -1
- package/CapColumn/index.js +13 -24
- package/CapColumn/styles.module.css +11 -0
- package/CapColumn/styles.module.scss.js +6 -0
- package/CapColumn/styles.scss +1 -1
- package/CapColumn/types.js +1 -1
- package/CapCondition/ConditionCustomField.js +125 -146
- package/CapCondition/ConditionDate.js +181 -268
- package/CapCondition/ConditionMultiSelect.js +19 -17
- package/CapCondition/ConditionMultiSelectTree.js +213 -259
- package/CapCondition/ConditionNumber.js +105 -171
- package/CapCondition/ConditionSKUUploader.js +55 -42
- package/CapCondition/ConditionStoreUploader.js +184 -217
- package/CapCondition/ConditionString.js +62 -88
- package/CapCondition/constants.js +130 -74
- package/CapCondition/helper.js +124 -143
- package/CapCondition/index.js +280 -281
- package/CapCondition/messages.js +48 -45
- package/CapCondition/style.js +35 -6
- package/CapCondition/styles.css +132 -0
- package/CapCondition/styles.scss +32 -32
- package/CapConditionPreview/constants.js +48 -27
- package/CapConditionPreview/index.js +271 -407
- package/CapConditionPreview/messages.js +113 -110
- package/CapConditionPreview/styles.module.css +56 -0
- package/CapConditionPreview/styles.module.scss.js +32 -0
- package/CapConditionPreview/styles.scss +3 -3
- package/CapConditionPreview/types.js +1 -1
- package/CapCustomCard/CapCustomCard.js +273 -405
- package/CapCustomCard/CapCustomCardList.js +32 -41
- package/CapCustomCard/constants.js +18 -14
- package/CapCustomCard/index.js +6 -11
- package/CapCustomCard/messages.js +10 -6
- package/CapCustomCard/styles.module.css +293 -0
- package/CapCustomCard/styles.module.scss.js +37 -0
- package/CapCustomCard/styles.scss +56 -56
- package/CapCustomCard/types.js +1 -1
- package/CapCustomCarousel/index.js +92 -90
- package/CapCustomCarousel/styles.module.css +47 -0
- package/CapCustomCarousel/styles.module.scss.js +10 -0
- package/CapCustomCarousel/styles.scss +9 -9
- package/CapCustomCarousel/types.js +1 -1
- package/CapCustomCheckboxList/index.js +47 -78
- package/CapCustomCheckboxList/styles.module.css +38 -0
- package/CapCustomCheckboxList/styles.module.scss.js +12 -0
- package/CapCustomCheckboxList/styles.scss +5 -5
- package/CapCustomCheckboxList/types.js +1 -1
- package/CapCustomList/index.js +72 -90
- package/CapCustomList/styles.module.css +24 -0
- package/CapCustomList/styles.module.scss.js +9 -0
- package/CapCustomList/styles.scss +4 -4
- package/CapCustomList/types.js +1 -1
- package/CapCustomSelect/index.js +245 -304
- package/CapCustomSelect/messages.js +12 -8
- package/CapCustomSelect/styles.module.css +105 -0
- package/CapCustomSelect/styles.module.scss.js +27 -0
- package/CapCustomSelect/styles.scss +6 -6
- package/CapCustomSelect/types.js +1 -1
- package/CapDatePicker/index.js +106 -112
- package/CapDatePicker/styles.module.css +27 -0
- package/CapDatePicker/styles.module.scss.js +7 -0
- package/CapDatePicker/styles.scss +1 -1
- package/CapDatePicker/types.js +1 -1
- package/CapDateRangePicker/index.js +180 -168
- package/CapDateRangePicker/styles.module.css +35 -0
- package/CapDateRangePicker/styles.module.scss.js +8 -0
- package/CapDateRangePicker/styles.scss +1 -1
- package/CapDateRangePicker/types.js +1 -1
- package/CapDateTimePicker/index.js +129 -143
- package/CapDateTimePicker/messages.js +14 -10
- package/CapDateTimePicker/styles.module.css +61 -0
- package/CapDateTimePicker/styles.module.scss.js +7 -0
- package/CapDateTimePicker/types.js +1 -1
- package/CapDateTimeRangePicker/constants.js +10 -5
- package/CapDateTimeRangePicker/index.js +283 -356
- package/CapDateTimeRangePicker/messages.js +22 -18
- package/CapDateTimeRangePicker/styles.module.css +80 -0
- package/CapDateTimeRangePicker/styles.module.scss.js +12 -0
- package/CapDateTimeRangePicker/styles.scss +2 -2
- package/CapDateTimeRangePicker/types.js +1 -1
- package/CapDivider/index.js +51 -58
- package/CapDivider/styles.css +17 -0
- package/CapDivider/styles.scss +10 -10
- package/CapDivider/types.js +1 -1
- package/CapDnDGraph/GraphBlockNode.js +107 -101
- package/CapDnDGraph/constants.js +82 -49
- package/CapDnDGraph/index.js +618 -731
- package/CapDnDGraph/mockdata.js +3153 -2828
- package/CapDnDGraph/reportingBlock.d.ts.map +1 -1
- package/CapDnDGraph/reportingBlock.js +65 -66
- package/CapDnDGraph/styles.css +74 -0
- package/CapDnDGraph/styles.scss +17 -17
- package/CapDnDGraph/utils.js +35 -83
- package/CapDndGraphSidebar/SideBarIcon.js +78 -75
- package/CapDndGraphSidebar/SidebarNodesRendered.js +40 -60
- package/CapDndGraphSidebar/index.js +39 -50
- package/CapDndGraphSidebar/styles.css +55 -0
- package/CapDndGraphSidebar/styles.scss +9 -9
- package/CapDragAndDrop/constants.js +15 -8
- package/CapDragAndDrop/index.js +69 -106
- package/CapDragAndDrop/styles.css +59 -0
- package/CapDragAndDrop/styles.scss +10 -10
- package/CapDragReorder/Card.js +62 -102
- package/CapDragReorder/ItemTypes.js +6 -3
- package/CapDragReorder/index.js +66 -86
- package/CapDragReorder/messages.js +10 -6
- package/CapDragReorder/styles.css +77 -0
- package/CapDragReorder/styles.js +15 -12
- package/CapDragReorder/styles.scss +16 -16
- package/CapDrawer/index.js +39 -49
- package/CapDrawer/types.js +1 -1
- package/CapDropdown/index.js +88 -117
- package/CapDropdown/styles.module.css +16 -0
- package/CapDropdown/styles.module.scss.js +6 -0
- package/CapDropdown/styles.scss +1 -1
- package/CapDropdown/types.js +1 -1
- package/CapEmptyDivWithBorder/index.js +38 -54
- package/CapEmptyDivWithBorder/styles.module.css +14 -0
- package/CapEmptyDivWithBorder/styles.module.scss.js +6 -0
- package/CapEmptyDivWithBorder/styles.scss +1 -1
- package/CapEmptyDivWithBorder/types.js +1 -1
- package/CapError/index.js +44 -39
- package/CapError/styles.module.css +22 -0
- package/CapError/styles.module.scss.js +13 -0
- package/CapError/styles.scss +4 -4
- package/CapError/types.js +1 -1
- package/CapErrorBoundary/index.js +83 -91
- package/CapErrorBoundary/styles.module.css +27 -0
- package/CapErrorBoundary/styles.module.scss.js +10 -0
- package/CapErrorBoundary/styles.scss +3 -3
- package/CapErrorBoundary/types.js +1 -1
- package/CapErrorStateIllustration/index.js +51 -69
- package/CapErrorStateIllustration/styles.module.css +38 -0
- package/CapErrorStateIllustration/styles.module.scss.js +11 -0
- package/CapErrorStateIllustration/styles.scss +6 -6
- package/CapErrorStateIllustration/types.js +1 -1
- package/CapEventCalendar/CalendarCanvas/index.js +212 -327
- package/CapEventCalendar/CalendarCanvas/utils.js +40 -37
- package/CapEventCalendar/components/DayDropdown/index.js +14 -36
- package/CapEventCalendar/components/MonthHeader/index.js +9 -16
- package/CapEventCalendar/constants.js +40 -6
- package/CapEventCalendar/drawUtils.js +73 -113
- package/CapEventCalendar/index.js +145 -161
- package/CapEventCalendar/styles.css +112 -0
- package/CapEventCalendar/styles.scss +13 -13
- package/CapEventCalendar/utils.js +107 -148
- package/CapExpressionEditor/index.d.ts +1 -0
- package/CapExpressionEditor/index.d.ts.map +1 -1
- package/CapExpressionEditor/index.js +64 -66
- package/CapExpressionEditor/js/expressionEditor.js +446 -708
- package/CapExpressionEditor/js/fixGrammar.js +23 -41
- package/CapExpressionEditor/js/grammar.js +1317 -654
- package/CapExpressionEditor/js/pickers.js +22 -57
- package/CapExpressionEditor/styles.module.css +182 -0
- package/CapExpressionEditor/styles.module.scss.js +8 -0
- package/CapExpressionEditor/styles.scss +27 -27
- package/CapExpressionEditor/types.js +1 -1
- package/CapForm/index.js +6 -23
- package/CapForm/styles.module.css +31 -0
- package/CapForm/styles.module.scss.js +6 -0
- package/CapForm/styles.scss +1 -1
- package/CapForm/types.js +1 -1
- package/CapFormItem/index.js +15 -27
- package/CapFormItem/styles.module.css +32 -0
- package/CapFormItem/styles.module.scss.js +6 -0
- package/CapFormItem/styles.scss +1 -1
- package/CapFormItem/types.js +1 -1
- package/CapGraph/constants.js +20 -19
- package/CapGraph/index.js +100 -120
- package/CapGraph/styles.module.css +8 -0
- package/CapGraph/styles.module.scss.js +4 -0
- package/CapGraph/types.js +1 -1
- package/CapHamburgerMenu/index.js +436 -487
- package/CapHamburgerMenu/styles.module.css +292 -0
- package/CapHamburgerMenu/styles.module.scss.js +36 -0
- package/CapHamburgerMenu/styles.scss +23 -23
- package/CapHamburgerMenu/types.js +1 -1
- package/CapHeader/index.js +64 -103
- package/CapHeader/styles.module.css +21 -0
- package/CapHeader/styles.module.scss.js +9 -0
- package/CapHeader/styles.scss +1 -1
- package/CapHeader/types.js +1 -1
- package/CapHeading/index.js +43 -47
- package/CapHeading/styles.module.css +175 -0
- package/CapHeading/styles.module.scss.js +58 -0
- package/CapHeading/styles.scss +19 -19
- package/CapHeading/types.js +1 -1
- package/CapHierarchyComponent/index.js +29 -41
- package/CapIcon/index.js +182 -194
- package/CapIcon/styles.module.css +73 -0
- package/CapIcon/styles.module.scss.js +35 -0
- package/CapIcon/styles.scss +13 -13
- package/CapIcon/types.js +1 -1
- package/CapIllustration/index.js +66 -97
- package/CapIllustration/styles.module.css +31 -0
- package/CapIllustration/styles.module.scss.js +10 -0
- package/CapIllustration/styles.scss +1 -1
- package/CapIllustration/types.js +1 -1
- package/CapImage/index.js +9 -23
- package/CapImage/styles.module.css +3 -0
- package/CapImage/styles.module.scss.js +6 -0
- package/CapImage/types.js +1 -1
- package/CapImportMFEComponent/index.js +36 -53
- package/CapImportMFEComponent/messages.js +13 -10
- package/CapImportMFEComponent/styles.module.css +16 -0
- package/CapImportMFEComponent/styles.module.scss.js +7 -0
- package/CapImportMFEComponent/styles.scss +2 -2
- package/CapImportMFEComponent/types.js +1 -1
- package/CapInfoNote/index.js +42 -56
- package/CapInfoNote/styles.module.css +20 -0
- package/CapInfoNote/styles.module.scss.js +8 -0
- package/CapInfoNote/styles.scss +3 -3
- package/CapInfoNote/types.js +1 -1
- package/CapInput/Number.js +12 -20
- package/CapInput/Search.js +13 -21
- package/CapInput/TextArea.js +13 -23
- package/CapInput/index.js +40 -43
- package/CapInput/messages.js +16 -17
- package/CapInput/styles.module.css +76 -0
- package/CapInput/styles.module.scss.js +7 -0
- package/CapInput/styles.scss +2 -2
- package/CapInput/types.js +1 -1
- package/CapLabel/index.js +58 -64
- package/CapLabel/styles.module.css +209 -0
- package/CapLabel/styles.module.scss.js +107 -0
- package/CapLabel/styles.scss +36 -36
- package/CapLabel/types.js +1 -1
- package/CapLanguageProvider/actions.js +22 -25
- package/CapLanguageProvider/antdLocales.d.ts +15 -0
- package/CapLanguageProvider/antdLocales.d.ts.map +1 -0
- package/CapLanguageProvider/antdLocales.js +53 -0
- package/CapLanguageProvider/constants.js +32 -21
- package/CapLanguageProvider/index.d.ts.map +1 -1
- package/CapLanguageProvider/index.js +84 -156
- package/CapLanguageProvider/reducer.js +27 -37
- package/CapLanguageProvider/saga.js +42 -48
- package/CapLanguageProvider/selector.js +17 -36
- package/CapLanguageProvider/types.js +1 -1
- package/CapLevelGraphRenderer/Tooltip.js +32 -43
- package/CapLevelGraphRenderer/index.js +213 -320
- package/CapLevelGraphRenderer/styles.module.css +30 -0
- package/CapLevelGraphRenderer/styles.module.scss.js +10 -0
- package/CapLevelGraphRenderer/styles.scss +7 -7
- package/CapLevelGraphRenderer/types.js +1 -1
- package/CapLink/index.js +32 -56
- package/CapLink/styles.module.css +74 -0
- package/CapLink/styles.module.scss.js +14 -0
- package/CapLink/styles.scss +14 -14
- package/CapLink/types.js +1 -1
- package/CapList/index.js +13 -33
- package/CapList/styles.module.css +11 -0
- package/CapList/styles.module.scss.js +6 -0
- package/CapList/styles.scss +3 -3
- package/CapList/types.js +1 -1
- package/CapListLayout/index.js +14 -25
- package/CapListLayout/styles.module.css +13 -0
- package/CapListLayout/styles.module.scss.js +6 -0
- package/CapListLayout/types.js +1 -1
- package/CapLogin/index.js +69 -79
- package/CapLogin/styles.module.css +39 -0
- package/CapLogin/styles.module.scss.js +12 -0
- package/CapLogin/types.js +1 -1
- package/CapMediaPreview/ImageRenderer.js +11 -18
- package/CapMediaPreview/MediaRenderer.js +29 -52
- package/CapMediaPreview/VideoPlayer.js +19 -32
- package/CapMediaPreview/constants.js +9 -7
- package/CapMediaPreview/index.js +138 -141
- package/CapMediaPreview/messages.js +14 -10
- package/CapMediaPreview/styles.css +135 -0
- package/CapMediaPreview/styles.scss +6 -6
- package/CapMenu/index.js +17 -35
- package/CapMenu/styles.module.scss.js +4 -0
- package/CapMenu/types.js +1 -1
- package/CapMobileDatePicker/index.js +54 -61
- package/CapMobileDatePicker/styles.css +19 -0
- package/CapMobileDatePicker/styles.scss +6 -6
- package/CapMobileDateRangePicker/ReactMobileDatePicker.js +942 -1012
- package/CapMobileDateRangePicker/ReactMobileDatePickerModule.d.ts +7 -0
- package/CapMobileDateRangePicker/ReactMobileDatePickerModule.d.ts.map +1 -0
- package/CapMobileDateRangePicker/ReactMobileDatePickerModule.js +4 -0
- package/CapMobileDateRangePicker/index.js +223 -260
- package/CapMobileDateRangePicker/styles.css +185 -0
- package/CapMobileDateRangePicker/styles.scss +62 -62
- package/CapModal/index.js +94 -116
- package/CapModal/messages.js +12 -13
- package/CapModal/styles.module.css +38 -0
- package/CapModal/styles.module.scss.js +11 -0
- package/CapModal/styles.scss +4 -4
- package/CapModal/types.js +1 -1
- package/CapMultiSelect/index.js +54 -81
- package/CapMultiSelect/styles.module.css +10 -0
- package/CapMultiSelect/styles.module.scss.js +7 -0
- package/CapMultiSelect/styles.scss +2 -2
- package/CapMultiSelect/types.js +1 -1
- package/CapMultiSelectDatePicker/index.js +63 -67
- package/CapMultiSelectDatePicker/messages.js +10 -6
- package/CapMultiSelectDatePicker/styles.module.css +51 -0
- package/CapMultiSelectDatePicker/styles.module.scss.js +20 -0
- package/CapMultiSelectDatePicker/styles.scss +5 -5
- package/CapMultiSelectDatePicker/types.js +1 -1
- package/CapMultiSelectWithTree/index.js +536 -598
- package/CapMultiSelectWithTree/styles.css +223 -0
- package/CapMultiSelectWithTree/styles.scss +46 -46
- package/CapMultiplePath/constants.js +18 -8
- package/CapMultiplePath/index.js +247 -405
- package/CapMultiplePath/mockdata.js +50 -88
- package/CapMultiplePath/styles.js +75 -34
- package/CapNavigation/constants.js +4 -1
- package/CapNavigation/index.js +311 -317
- package/CapNavigation/messages.js +12 -8
- package/CapNavigation/mockdata.js +298 -270
- package/CapNavigation/styles.module.css +19 -0
- package/CapNavigation/styles.module.scss.js +7 -0
- package/CapNavigation/styles.scss +2 -2
- package/CapNavigation/types.js +1 -1
- package/CapNotification/index.js +39 -77
- package/CapNotification/styles.module.css +49 -0
- package/CapNotification/styles.module.scss.js +16 -0
- package/CapNotification/styles.scss +10 -10
- package/CapNotification/types.js +1 -1
- package/CapNotificationDropdown/CapNotificationDefaultCard.js +90 -118
- package/CapNotificationDropdown/constants.js +4 -1
- package/CapNotificationDropdown/index.js +67 -65
- package/CapNotificationDropdown/styles.module.css +140 -0
- package/CapNotificationDropdown/styles.module.scss.js +25 -0
- package/CapNotificationDropdown/styles.scss +25 -25
- package/CapNotificationDropdown/types.js +1 -1
- package/CapPopover/index.js +56 -63
- package/CapPopover/styles.module.css +11 -0
- package/CapPopover/styles.module.scss.js +4 -0
- package/CapPopover/types.js +1 -1
- package/CapPopoverTree/index.js +147 -211
- package/CapPopoverTree/style.js +94 -13
- package/CapPopoverTree/styles.css +36 -0
- package/CapPopoverTree/styles.scss +10 -10
- package/CapProductSelection/constants.js +18 -8
- package/CapProductSelection/index.js +201 -248
- package/CapProductSelection/style.js +38 -8
- package/CapProductSelection/styles.scss +14 -14
- package/CapProgress/index.js +10 -24
- package/CapProgress/styles.module.css +36 -0
- package/CapProgress/styles.module.scss.js +6 -0
- package/CapProgress/styles.scss +9 -9
- package/CapProgress/types.js +1 -1
- package/CapRadio/index.js +33 -51
- package/CapRadio/styles.module.css +43 -0
- package/CapRadio/styles.module.scss.js +12 -0
- package/CapRadio/styles.scss +4 -4
- package/CapRadio/types.js +1 -1
- package/CapRadioButton/index.js +13 -22
- package/CapRadioButton/styles.module.css +21 -0
- package/CapRadioButton/styles.module.scss.js +6 -0
- package/CapRadioButton/styles.scss +2 -2
- package/CapRadioButton/types.js +1 -1
- package/CapRadioCard/index.js +102 -114
- package/CapRadioCard/styles.module.css +123 -0
- package/CapRadioCard/styles.module.scss.js +47 -0
- package/CapRadioCard/styles.scss +26 -26
- package/CapRadioCard/types.js +1 -1
- package/CapRadioGroup/index.js +18 -26
- package/CapRadioGroup/styles.module.css +18 -0
- package/CapRadioGroup/styles.module.scss.js +6 -0
- package/CapRadioGroup/styles.scss +3 -3
- package/CapRadioGroup/types.js +1 -1
- package/CapReorderComponent/index.js +96 -97
- package/CapReorderComponent/styles.module.css +54 -0
- package/CapReorderComponent/styles.module.scss.js +13 -0
- package/CapReorderComponent/styles.scss +8 -8
- package/CapReorderComponent/types.js +1 -1
- package/CapRoadMap/index.js +45 -50
- package/CapRoadMap/styles.module.css +56 -0
- package/CapRoadMap/styles.module.scss.js +8 -0
- package/CapRoadMap/styles.scss +12 -12
- package/CapRoadMap/types.js +1 -1
- package/CapRow/index.js +70 -73
- package/CapRow/styles.module.css +39 -0
- package/CapRow/styles.module.scss.js +14 -0
- package/CapRow/styles.scss +9 -9
- package/CapRow/types.js +1 -1
- package/CapSKUUploader/index.js +118 -129
- package/CapSKUUploader/styles.module.css +29 -0
- package/CapSKUUploader/styles.module.scss.js +7 -0
- package/CapSKUUploader/styles.scss +6 -6
- package/CapSKUUploader/types.js +1 -1
- package/CapSecondaryTopBar/index.js +94 -87
- package/CapSecondaryTopBar/styles.module.css +82 -0
- package/CapSecondaryTopBar/styles.module.scss.js +16 -0
- package/CapSecondaryTopBar/styles.scss +13 -13
- package/CapSecondaryTopBar/types.js +1 -1
- package/CapSelect/index.js +132 -152
- package/CapSelect/styles.module.css +51 -0
- package/CapSelect/styles.module.scss.js +9 -0
- package/CapSelect/styles.scss +11 -11
- package/CapSelect/types.js +1 -1
- package/CapSelect/utils.js +12 -13
- package/CapSelectFilter/index.js +82 -90
- package/CapSelectFilter/styles.module.css +68 -0
- package/CapSelectFilter/styles.module.scss.js +16 -0
- package/CapSelectFilter/styles.scss +10 -10
- package/CapSelectFilter/types.js +1 -1
- package/CapShape/index.js +41 -36
- package/CapShape/styles.module.css +17 -0
- package/CapShape/styles.module.scss.js +8 -0
- package/CapShape/styles.scss +1 -1
- package/CapShape/types.js +1 -1
- package/CapSideBar/MenuSearch.js +135 -172
- package/CapSideBar/_capSideBar.scss +21 -21
- package/CapSideBar/_menuSearch.module.css +131 -0
- package/CapSideBar/_menuSearch.module.scss.js +24 -0
- package/CapSideBar/_menuSearch.scss +11 -11
- package/CapSideBar/index.js +147 -165
- package/CapSideBar/styles.module.css +254 -0
- package/CapSideBar/styles.module.scss.js +28 -0
- package/CapSideBar/types.js +1 -1
- package/CapSkeleton/index.js +8 -16
- package/CapSkeleton/types.js +1 -1
- package/CapSlideBox/index.js +84 -91
- package/CapSlideBox/styles.module.css +119 -0
- package/CapSlideBox/styles.module.scss.js +28 -0
- package/CapSlideBox/styles.scss +21 -21
- package/CapSlideBox/types.js +1 -1
- package/CapSlider/index.js +81 -101
- package/CapSlider/styles.module.css +41 -0
- package/CapSlider/styles.module.scss.js +8 -0
- package/CapSlider/styles.scss +12 -12
- package/CapSlider/types.js +1 -1
- package/CapSnackBar/index.js +35 -42
- package/CapSnackBar/styles.module.css +24 -0
- package/CapSnackBar/styles.module.scss.js +7 -0
- package/CapSnackBar/styles.scss +3 -3
- package/CapSnackBar/types.js +1 -1
- package/CapSomethingWentWrong/index.js +42 -49
- package/CapSomethingWentWrong/messages.js +13 -10
- package/CapSomethingWentWrong/styles.module.css +18 -0
- package/CapSomethingWentWrong/styles.module.scss.js +7 -0
- package/CapSomethingWentWrong/styles.scss +1 -1
- package/CapSomethingWentWrong/types.js +1 -1
- package/CapSpin/index.js +6 -16
- package/CapSpin/types.js +1 -1
- package/CapSplit/SplitAudienceInfo.js +38 -54
- package/CapSplit/constants.js +11 -9
- package/CapSplit/index.js +151 -173
- package/CapSplit/messages.js +22 -18
- package/CapSplit/styles.module.css +116 -0
- package/CapSplit/styles.module.scss.js +21 -0
- package/CapSplit/styles.scss +21 -21
- package/CapSplit/types.js +1 -1
- package/CapStaticTemplates/constants.js +6 -2
- package/CapStaticTemplates/index.js +228 -292
- package/CapStaticTemplates/style.js +216 -21
- package/CapStatisticCard/index.js +60 -81
- package/CapStatisticCard/styles.module.css +24 -0
- package/CapStatisticCard/styles.module.scss.js +13 -0
- package/CapStatisticCard/styles.scss +6 -6
- package/CapStatisticCard/types.js +1 -1
- package/CapStatus/index.js +32 -39
- package/CapStatus/styles.module.css +16 -0
- package/CapStatus/styles.module.scss.js +6 -0
- package/CapStatus/styles.scss +1 -1
- package/CapStatus/types.js +1 -1
- package/CapSteps/index.js +31 -82
- package/CapSteps/styles.module.css +36 -0
- package/CapSteps/styles.module.scss.js +6 -0
- package/CapSteps/styles.scss +9 -9
- package/CapSteps/types.js +1 -1
- package/CapStepsAccordian/index.js +50 -96
- package/CapStepsAccordian/styles.module.css +49 -0
- package/CapStepsAccordian/styles.module.scss.js +10 -0
- package/CapStepsAccordian/styles.scss +8 -8
- package/CapStepsAccordian/types.js +1 -1
- package/CapSupportVideosWrapper/ResizablePIP.js +334 -318
- package/CapSupportVideosWrapper/constants.js +26 -12
- package/CapSupportVideosWrapper/index.js +108 -116
- package/CapSupportVideosWrapper/messages.js +15 -12
- package/CapSupportVideosWrapper/styles.css +146 -0
- package/CapSupportVideosWrapper/styles.module.scss.js +28 -0
- package/CapSupportVideosWrapper/styles.scss +21 -21
- package/CapSupportVideosWrapper/types.js +1 -1
- package/CapSupportVideosWrapper/utils.js +14 -10
- package/CapSwitch/index.js +22 -27
- package/CapSwitch/styles.module.css +35 -0
- package/CapSwitch/styles.module.scss.js +6 -0
- package/CapSwitch/styles.scss +7 -7
- package/CapSwitch/types.js +1 -1
- package/CapTab/index.js +59 -92
- package/CapTab/styles.module.css +20 -0
- package/CapTab/styles.module.scss.js +8 -0
- package/CapTab/styles.scss +4 -4
- package/CapTab/types.js +1 -1
- package/CapTabV3/index.js +41 -56
- package/CapTabV3/styles.module.css +12 -0
- package/CapTabV3/styles.module.scss.js +6 -0
- package/CapTabV3/styles.scss +2 -2
- package/CapTabV3/types.js +1 -1
- package/CapTable/index.js +106 -131
- package/CapTable/loadable.js +9 -11
- package/CapTable/styles.module.css +49 -0
- package/CapTable/styles.module.scss.js +7 -0
- package/CapTable/styles.scss +2 -2
- package/CapTable/types.js +1 -1
- package/CapTable/utils.js +44 -84
- package/CapTag/index.js +21 -27
- package/CapTag/styles.module.css +27 -0
- package/CapTag/styles.module.scss.js +13 -0
- package/CapTag/styles.scss +3 -3
- package/CapTag/types.js +1 -1
- package/CapTagDropdown/index.js +135 -166
- package/CapTagDropdown/messages.js +14 -10
- package/CapTagDropdown/styles.module.css +57 -0
- package/CapTagDropdown/styles.module.scss.js +12 -0
- package/CapTagDropdown/styles.scss +7 -7
- package/CapTagDropdown/types.js +1 -1
- package/CapTimePicker/index.js +75 -82
- package/CapTimePicker/styles.module.css +11 -0
- package/CapTimePicker/styles.module.scss.js +6 -0
- package/CapTimePicker/styles.scss +2 -2
- package/CapTimePicker/types.js +1 -1
- package/CapTimeline/CapTimelineCard.js +132 -118
- package/CapTimeline/CapTimelinePanesWrapper.js +37 -47
- package/CapTimeline/constants.js +6 -2
- package/CapTimeline/index.js +55 -65
- package/CapTimeline/styles.css +138 -0
- package/CapTimeline/styles.scss +43 -43
- package/CapTimelineNested/CapTimelineNestedCard.js +133 -110
- package/CapTimelineNested/CapTimelineNestedPanesWrapper.js +48 -56
- package/CapTimelineNested/NestedCard.js +56 -45
- package/CapTimelineNested/NestedCardParent.js +142 -115
- package/CapTimelineNested/_actionsAndTriggers.css +117 -0
- package/CapTimelineNested/_actionsAndTriggers.scss +9 -9
- package/CapTimelineNested/_capTimeline.scss +36 -36
- package/CapTimelineNested/_trigger.css +59 -0
- package/CapTimelineNested/assets/triggerComplete.svg.js +4 -0
- package/CapTimelineNested/assets/triggerOptional.svg.js +4 -0
- package/CapTimelineNested/assets/triggerPending.svg.js +4 -0
- package/CapTimelineNested/constants.js +12 -5
- package/CapTimelineNested/index.js +80 -82
- package/CapTimelineNested/styles.css +289 -0
- package/CapTooltip/index.js +73 -72
- package/CapTooltip/styles.module.css +27 -0
- package/CapTooltip/styles.module.scss.js +7 -0
- package/CapTooltip/styles.scss +3 -3
- package/CapTooltip/types.js +1 -1
- package/CapTooltipWithInfo/index.js +21 -40
- package/CapTooltipWithInfo/styles.module.css +26 -0
- package/CapTooltipWithInfo/styles.module.scss.js +7 -0
- package/CapTooltipWithInfo/styles.scss +4 -4
- package/CapTooltipWithInfo/types.js +1 -1
- package/CapTopBar/CapOrgSelect.js +115 -131
- package/CapTopBar/CapOrgSelect.module.css +33 -0
- package/CapTopBar/CapOrgSelect.module.scss.js +10 -0
- package/CapTopBar/CapOrgSelect.scss +5 -5
- package/CapTopBar/CapOrgSelectUtils.js +100 -169
- package/CapTopBar/constants.js +4 -1
- package/CapTopBar/index.js +375 -377
- package/CapTopBar/mockdata.js +298 -270
- package/CapTopBar/styles.module.css +426 -0
- package/CapTopBar/styles.module.scss.js +81 -0
- package/CapTopBar/styles.scss +34 -34
- package/CapTopBar/themeConfig.js +17 -17
- package/CapTopBar/types.js +1 -1
- package/CapTopBar/utils.js +47 -49
- package/CapTree/index.js +15 -60
- package/CapTree/styles.module.css +11 -0
- package/CapTree/styles.module.scss.js +8 -0
- package/CapTree/styles.scss +2 -2
- package/CapTree/types.js +1 -1
- package/CapTreeSelect/index.js +71 -101
- package/CapTreeSelect/styles.module.css +49 -0
- package/CapTreeSelect/styles.module.scss.js +12 -0
- package/CapTreeSelect/styles.scss +11 -11
- package/CapTreeSelect/types.js +1 -1
- package/CapTreeView/index.js +117 -160
- package/CapTreeView/styles.css +62 -0
- package/CapTreeView/styles.scss +15 -15
- package/CapTruncateList/index.js +60 -62
- package/CapTruncateList/messages.js +9 -6
- package/CapTruncateList/types.js +1 -1
- package/CapUnifiedSelect/CustomDropdown.js +189 -202
- package/CapUnifiedSelect/DropdownHeader.js +60 -35
- package/CapUnifiedSelect/components.js +58 -71
- package/CapUnifiedSelect/constants.js +24 -19
- package/CapUnifiedSelect/enhanceOptions.js +100 -123
- package/CapUnifiedSelect/index.js +288 -269
- package/CapUnifiedSelect/messages.js +24 -20
- package/CapUnifiedSelect/styles.module.css +651 -0
- package/CapUnifiedSelect/styles.module.scss.js +65 -0
- package/CapUnifiedSelect/styles.scss +79 -79
- package/CapUnifiedSelect/testData.js +126 -159
- package/CapUnifiedSelect/types.js +1 -1
- package/CapUnifiedSelect/useCapUnifiedSelect.js +317 -310
- package/CapUnifiedSelect/useInfiniteScroll.js +98 -113
- package/CapUnifiedSelect/utils.js +95 -156
- package/CapUploader/index.js +13 -31
- package/CapUploader/styles.module.css +39 -0
- package/CapUploader/styles.module.scss.js +4 -0
- package/CapUploader/types.js +1 -1
- package/CapUserProfile/UserProfileTab.js +339 -316
- package/CapUserProfile/constants.js +126 -97
- package/CapUserProfile/index.js +115 -137
- package/CapUserProfile/messages.js +50 -46
- package/CapUserProfile/mockData.js +394 -346
- package/CapUserProfile/styles.module.css +77 -0
- package/CapUserProfile/styles.module.scss.js +19 -0
- package/CapUserProfile/styles.scss +18 -18
- package/CapUserProfile/types.js +1 -1
- package/CapUserProfile/utils.js +84 -161
- package/CapVerticalGroupTable/index.js +50 -61
- package/CapVerticalGroupTable/messages.js +9 -6
- package/CapVerticalGroupTable/style.js +11 -6
- package/CapVerticalGroupTable/styles.css +22 -0
- package/CapVerticalGroupTable/styles.scss +4 -4
- package/CapVirtualList/index.js +8 -16
- package/CapVirtualList/types.js +1 -1
- package/CapVirtualSelect/actions.js +13 -14
- package/CapVirtualSelect/constants.js +26 -12
- package/CapVirtualSelect/index.js +302 -316
- package/CapVirtualSelect/messages.js +10 -6
- package/CapVirtualSelect/reducer.js +46 -62
- package/CapVirtualSelect/saga.js +74 -105
- package/CapVirtualSelect/selectors.js +13 -30
- package/CapVirtualSelect/styles.css +110 -0
- package/CapVirtualSelect/utils.js +7 -12
- package/ClearDataOnUnmountHoc/index.js +10 -10
- package/LocaleHoc/index.js +28 -29
- package/assets/HOCs/ComponentWithLabelHOC/index.js +113 -114
- package/assets/HOCs/ComponentWithLabelHOC/styles.module.css +143 -0
- package/assets/HOCs/ComponentWithLabelHOC/styles.module.scss.js +26 -0
- package/assets/HOCs/ComponentWithLabelHOC/styles.scss +7 -7
- package/assets/HOCs/ComponentWithLabelHOC/types.js +1 -1
- package/assets/HOCs/index.js +4 -1
- package/assets/icons/add.js +17 -34
- package/assets/icons/back.js +9 -13
- package/assets/icons/calendar.js +16 -33
- package/assets/icons/capillary_logo.svg.js +4 -0
- package/assets/icons/capillary_logo_v2.png.js +4 -0
- package/assets/icons/check-filled.js +20 -17
- package/assets/icons/closeIcon.js +29 -38
- package/assets/icons/dropdownIcon.js +17 -32
- package/assets/icons/dynamic.js +16 -33
- package/assets/icons/index.js +36 -17
- package/assets/icons/info.js +29 -37
- package/assets/icons/logoBackground.js +14 -19
- package/assets/icons/message.js +20 -40
- package/assets/icons/more.js +5 -13
- package/assets/icons/outbound.js +16 -33
- package/assets/icons/searchIcon.js +16 -34
- package/assets/icons/selectedTick.js +17 -38
- package/assets/icons/survey.js +16 -34
- package/assets/icons/user.js +16 -33
- package/assets/icons/view.js +19 -36
- package/assets/images/EmptyStateIllustrationForPromos.png.js +4 -0
- package/assets/images/aiRA-icon.svg.js +4 -0
- package/assets/images/bootupPageCopilotIcon.svg.js +4 -0
- package/assets/images/cart.svg.js +4 -0
- package/assets/images/expiryErrorStateIllustration.svg.js +4 -0
- package/assets/images/featureUiNotEnabledIllustration.svg.js +4 -0
- package/assets/images/file-selector.svg.js +4 -0
- package/assets/images/group-3.svg.js +4 -0
- package/assets/images/offer.svg.js +4 -0
- package/assets/images/refreshErrorStateIllustration.svg.js +4 -0
- package/assets/images/repair-illustration.png.js +4 -0
- package/assets/images/sendIconDisabled.svg.js +4 -0
- package/assets/images/sendIconEnabled.svg.js +4 -0
- package/assets/svgIcons/Icons/Academy.js +23 -17
- package/assets/svgIcons/Icons/AcademyBackground.js +46 -45
- package/assets/svgIcons/Icons/Add.js +15 -14
- package/assets/svgIcons/Icons/AddMedia.js +21 -15
- package/assets/svgIcons/Icons/AddPhoto.js +21 -15
- package/assets/svgIcons/Icons/AddProfile.js +23 -17
- package/assets/svgIcons/Icons/AddUserBackground.js +50 -57
- package/assets/svgIcons/Icons/Ads.js +21 -15
- package/assets/svgIcons/Icons/AiraBotChat.js +243 -114
- package/assets/svgIcons/Icons/AiraBotDark.js +299 -159
- package/assets/svgIcons/Icons/AiraBotTitle.js +298 -148
- package/assets/svgIcons/Icons/AiraChatTitleBar.js +15 -46
- package/assets/svgIcons/Icons/AiraFAB.js +51 -44
- package/assets/svgIcons/Icons/AiraUserChat.js +53 -36
- package/assets/svgIcons/Icons/Alarm.js +21 -15
- package/assets/svgIcons/Icons/Alert.js +21 -15
- package/assets/svgIcons/Icons/AlertRed.js +49 -39
- package/assets/svgIcons/Icons/AlertWarning.js +24 -18
- package/assets/svgIcons/Icons/Android.js +15 -14
- package/assets/svgIcons/Icons/Api.js +31 -41
- package/assets/svgIcons/Icons/Apps.js +21 -15
- package/assets/svgIcons/Icons/ArrowDown.js +20 -14
- package/assets/svgIcons/Icons/ArrowFilled.js +46 -35
- package/assets/svgIcons/Icons/ArrowUp.js +26 -20
- package/assets/svgIcons/Icons/Attachment.js +21 -15
- package/assets/svgIcons/Icons/Attribution.js +20 -23
- package/assets/svgIcons/Icons/Back.js +21 -15
- package/assets/svgIcons/Icons/Badges.js +48 -37
- package/assets/svgIcons/Icons/Basket.js +21 -15
- package/assets/svgIcons/Icons/BehaviouralProfile.js +10 -43
- package/assets/svgIcons/Icons/Beta.js +8 -22
- package/assets/svgIcons/Icons/Bill.js +30 -39
- package/assets/svgIcons/Icons/BoldInfo.js +50 -40
- package/assets/svgIcons/Icons/Box.js +22 -16
- package/assets/svgIcons/Icons/Bulb.js +21 -15
- package/assets/svgIcons/Icons/Button.js +30 -39
- package/assets/svgIcons/Icons/Calendar.js +21 -15
- package/assets/svgIcons/Icons/CalendarActive.js +15 -14
- package/assets/svgIcons/Icons/Call.js +20 -14
- package/assets/svgIcons/Icons/CapillaryLogo.js +304 -345
- package/assets/svgIcons/Icons/Capture.js +21 -15
- package/assets/svgIcons/Icons/CarouselNormal.js +18 -18
- package/assets/svgIcons/Icons/CarouselSelected.js +18 -18
- package/assets/svgIcons/Icons/Carrot.js +15 -14
- package/assets/svgIcons/Icons/CartPromotion.js +21 -14
- package/assets/svgIcons/Icons/ChannelPriority.js +44 -43
- package/assets/svgIcons/Icons/Chart.js +21 -15
- package/assets/svgIcons/Icons/ChatBot.js +52 -41
- package/assets/svgIcons/Icons/ChatBubble.js +15 -14
- package/assets/svgIcons/Icons/CheckCircle.js +21 -15
- package/assets/svgIcons/Icons/CheckFilled.js +36 -29
- package/assets/svgIcons/Icons/CheckFilledDefault.js +15 -14
- package/assets/svgIcons/Icons/CheckFilledPlus.js +50 -49
- package/assets/svgIcons/Icons/ChevronDown.js +21 -15
- package/assets/svgIcons/Icons/ChevronLeft.js +21 -15
- package/assets/svgIcons/Icons/ChevronRight.js +21 -15
- package/assets/svgIcons/Icons/ChevronUp.js +21 -15
- package/assets/svgIcons/Icons/CircleDollar.js +23 -17
- package/assets/svgIcons/Icons/Click.js +28 -37
- package/assets/svgIcons/Icons/Clock.js +21 -15
- package/assets/svgIcons/Icons/Close.js +15 -14
- package/assets/svgIcons/Icons/Code.js +21 -15
- package/assets/svgIcons/Icons/Collapse2.js +22 -16
- package/assets/svgIcons/Icons/CollapseIcon.js +22 -16
- package/assets/svgIcons/Icons/Combine.js +26 -23
- package/assets/svgIcons/Icons/CommentMessage.js +21 -15
- package/assets/svgIcons/Icons/Communication.js +15 -14
- package/assets/svgIcons/Icons/Compare.js +22 -16
- package/assets/svgIcons/Icons/Connect.js +21 -15
- package/assets/svgIcons/Icons/Copy.js +21 -15
- package/assets/svgIcons/Icons/CriticalInfo.js +5 -18
- package/assets/svgIcons/Icons/CriticalWarning.js +24 -18
- package/assets/svgIcons/Icons/Data.js +21 -15
- package/assets/svgIcons/Icons/DefaultProfile.js +16 -15
- package/assets/svgIcons/Icons/Delay.js +21 -15
- package/assets/svgIcons/Icons/Delete.js +21 -15
- package/assets/svgIcons/Icons/Desktop.js +28 -37
- package/assets/svgIcons/Icons/Diamond.js +22 -16
- package/assets/svgIcons/Icons/DisLike.js +5 -16
- package/assets/svgIcons/Icons/DisneyHotstar.js +40 -40
- package/assets/svgIcons/Icons/Documentation.js +21 -15
- package/assets/svgIcons/Icons/Dollar.js +21 -15
- package/assets/svgIcons/Icons/DollarBackground.js +50 -57
- package/assets/svgIcons/Icons/Downgrade.js +15 -14
- package/assets/svgIcons/Icons/Download.js +21 -15
- package/assets/svgIcons/Icons/DraftFailed.js +43 -29
- package/assets/svgIcons/Icons/DraftPartiallyFailed.js +43 -29
- package/assets/svgIcons/Icons/Drag.js +21 -15
- package/assets/svgIcons/Icons/Draggable.js +22 -16
- package/assets/svgIcons/Icons/Earth.js +22 -16
- package/assets/svgIcons/Icons/Edit.js +21 -15
- package/assets/svgIcons/Icons/Email.js +9 -35
- package/assets/svgIcons/Icons/EmailFilled.js +42 -57
- package/assets/svgIcons/Icons/EnagementSplit.js +26 -23
- package/assets/svgIcons/Icons/End.js +25 -22
- package/assets/svgIcons/Icons/Enter.js +5 -16
- package/assets/svgIcons/Icons/Entry.js +26 -23
- package/assets/svgIcons/Icons/Error.js +28 -37
- package/assets/svgIcons/Icons/ErrorDot.js +16 -19
- package/assets/svgIcons/Icons/ErrorIndicator.js +40 -50
- package/assets/svgIcons/Icons/Exclude.js +50 -40
- package/assets/svgIcons/Icons/Exit.js +25 -22
- package/assets/svgIcons/Icons/ExitTrigger.js +11 -52
- package/assets/svgIcons/Icons/ExitTriggerFilled.js +11 -52
- package/assets/svgIcons/Icons/Expand2.js +22 -16
- package/assets/svgIcons/Icons/ExpandIcon.js +22 -16
- package/assets/svgIcons/Icons/Expander.js +22 -16
- package/assets/svgIcons/Icons/Extension.js +21 -15
- package/assets/svgIcons/Icons/Eye.js +21 -15
- package/assets/svgIcons/Icons/Facebook.js +28 -37
- package/assets/svgIcons/Icons/FacebookFilled.js +31 -23
- package/assets/svgIcons/Icons/FacebookReach.js +16 -33
- package/assets/svgIcons/Icons/File.js +21 -15
- package/assets/svgIcons/Icons/FileUpload.js +60 -50
- package/assets/svgIcons/Icons/Filled.js +23 -17
- package/assets/svgIcons/Icons/FilledDisLike.js +5 -16
- package/assets/svgIcons/Icons/FilledLike.js +5 -14
- package/assets/svgIcons/Icons/Filter.js +21 -15
- package/assets/svgIcons/Icons/Folder.js +28 -38
- package/assets/svgIcons/Icons/Footwear.js +22 -16
- package/assets/svgIcons/Icons/Forward.js +23 -17
- package/assets/svgIcons/Icons/Ftp.js +19 -18
- package/assets/svgIcons/Icons/FtpConnector.js +29 -17
- package/assets/svgIcons/Icons/Funnel.js +21 -15
- package/assets/svgIcons/Icons/Gallery.js +21 -15
- package/assets/svgIcons/Icons/GalleryIcon.js +5 -14
- package/assets/svgIcons/Icons/Gender.js +22 -16
- package/assets/svgIcons/Icons/Giftvoucher.js +23 -17
- package/assets/svgIcons/Icons/GoogleAd.js +40 -34
- package/assets/svgIcons/Icons/Graph.js +21 -15
- package/assets/svgIcons/Icons/Greetings.js +37 -37
- package/assets/svgIcons/Icons/Group.js +30 -39
- package/assets/svgIcons/Icons/GroupChat.js +21 -15
- package/assets/svgIcons/Icons/Groups.js +21 -15
- package/assets/svgIcons/Icons/GrowthGraph.js +21 -15
- package/assets/svgIcons/Icons/HeadphoneBackground.js +46 -45
- package/assets/svgIcons/Icons/Headphones.js +23 -17
- package/assets/svgIcons/Icons/Heart.js +15 -14
- package/assets/svgIcons/Icons/HeartPlus.js +26 -19
- package/assets/svgIcons/Icons/Help.js +24 -26
- package/assets/svgIcons/Icons/Home.js +23 -17
- package/assets/svgIcons/Icons/IaMascot.js +272 -134
- package/assets/svgIcons/Icons/Image.js +15 -14
- package/assets/svgIcons/Icons/ImageMessageNormal.js +22 -16
- package/assets/svgIcons/Icons/ImageMessageSelected.js +22 -16
- package/assets/svgIcons/Icons/InApp.js +54 -41
- package/assets/svgIcons/Icons/InProgress.js +27 -23
- package/assets/svgIcons/Icons/Info.js +21 -15
- package/assets/svgIcons/Icons/InfoWarning.js +9 -40
- package/assets/svgIcons/Icons/InfoWithError.js +51 -46
- package/assets/svgIcons/Icons/Integrations.js +52 -46
- package/assets/svgIcons/Icons/Intersect.js +24 -22
- package/assets/svgIcons/Icons/Ios.js +15 -14
- package/assets/svgIcons/Icons/JavaScript.js +21 -15
- package/assets/svgIcons/Icons/JoinLink.js +24 -18
- package/assets/svgIcons/Icons/Journey.js +21 -15
- package/assets/svgIcons/Icons/Json.js +35 -23
- package/assets/svgIcons/Icons/JumpIcon.js +22 -16
- package/assets/svgIcons/Icons/Lab.js +21 -15
- package/assets/svgIcons/Icons/Language.js +22 -16
- package/assets/svgIcons/Icons/Launch.js +28 -36
- package/assets/svgIcons/Icons/Leaf.js +22 -16
- package/assets/svgIcons/Icons/Library.js +22 -16
- package/assets/svgIcons/Icons/Lightning.js +15 -15
- package/assets/svgIcons/Icons/Like.js +5 -14
- package/assets/svgIcons/Icons/Line.js +21 -15
- package/assets/svgIcons/Icons/ListActive.js +15 -14
- package/assets/svgIcons/Icons/Location.js +15 -14
- package/assets/svgIcons/Icons/Lock.js +28 -36
- package/assets/svgIcons/Icons/Logout.js +15 -14
- package/assets/svgIcons/Icons/LoveFilled.js +38 -33
- package/assets/svgIcons/Icons/Loyalty.js +21 -15
- package/assets/svgIcons/Icons/LoyaltyBackground.js +50 -57
- package/assets/svgIcons/Icons/Mail.js +21 -15
- package/assets/svgIcons/Icons/Media.js +21 -15
- package/assets/svgIcons/Icons/Megaphone.js +15 -15
- package/assets/svgIcons/Icons/MegaphoneBackground.js +43 -56
- package/assets/svgIcons/Icons/MegaphoneFilled.js +21 -15
- package/assets/svgIcons/Icons/MemberCare.js +21 -15
- package/assets/svgIcons/Icons/Message.js +15 -15
- package/assets/svgIcons/Icons/MessageFilled.js +21 -15
- package/assets/svgIcons/Icons/MessageWithTransform.js +30 -39
- package/assets/svgIcons/Icons/Migrate.js +5 -16
- package/assets/svgIcons/Icons/Minimizer.js +22 -16
- package/assets/svgIcons/Icons/Minus.js +21 -15
- package/assets/svgIcons/Icons/Mobile.js +28 -36
- package/assets/svgIcons/Icons/Models.js +21 -15
- package/assets/svgIcons/Icons/MonitorBackground.js +49 -48
- package/assets/svgIcons/Icons/More.js +21 -15
- package/assets/svgIcons/Icons/MoreApplications.js +21 -15
- package/assets/svgIcons/Icons/Mpush.js +21 -15
- package/assets/svgIcons/Icons/MpushFilled.js +42 -57
- package/assets/svgIcons/Icons/MyLocation.js +25 -27
- package/assets/svgIcons/Icons/NotSent.js +28 -37
- package/assets/svgIcons/Icons/Note.js +24 -18
- package/assets/svgIcons/Icons/NoteTickMaterial.js +21 -15
- package/assets/svgIcons/Icons/NoteWithTick.js +21 -15
- package/assets/svgIcons/Icons/Notepad.js +21 -15
- package/assets/svgIcons/Icons/NotepadMaterial.js +18 -17
- package/assets/svgIcons/Icons/Notifications.js +21 -15
- package/assets/svgIcons/Icons/Nowhere.js +50 -40
- package/assets/svgIcons/Icons/Offer.js +21 -15
- package/assets/svgIcons/Icons/OfferWithColor.js +22 -16
- package/assets/svgIcons/Icons/OnlyIncentives.js +48 -37
- package/assets/svgIcons/Icons/OpenInNew.js +15 -14
- package/assets/svgIcons/Icons/OpenInNewLight.js +21 -15
- package/assets/svgIcons/Icons/Org.js +26 -23
- package/assets/svgIcons/Icons/OrgSettings.js +21 -15
- package/assets/svgIcons/Icons/PartnerProgram.js +5 -14
- package/assets/svgIcons/Icons/Pause.js +21 -15
- package/assets/svgIcons/Icons/Paused.js +24 -18
- package/assets/svgIcons/Icons/Performance.js +21 -15
- package/assets/svgIcons/Icons/Person.js +15 -14
- package/assets/svgIcons/Icons/PersonLove.js +30 -38
- package/assets/svgIcons/Icons/Personlaisation.js +21 -15
- package/assets/svgIcons/Icons/Play.js +21 -15
- package/assets/svgIcons/Icons/Plus.js +21 -15
- package/assets/svgIcons/Icons/Pointer.js +21 -15
- package/assets/svgIcons/Icons/Points.js +23 -17
- package/assets/svgIcons/Icons/PointsV1.js +22 -15
- package/assets/svgIcons/Icons/Premium.js +21 -15
- package/assets/svgIcons/Icons/PremiumColored.js +20 -28
- package/assets/svgIcons/Icons/ProductProfile.js +5 -18
- package/assets/svgIcons/Icons/Programs.js +21 -15
- package/assets/svgIcons/Icons/PromotionProfile.js +5 -14
- package/assets/svgIcons/Icons/RandomSplitBlock.js +20 -13
- package/assets/svgIcons/Icons/RbacLock.js +22 -16
- package/assets/svgIcons/Icons/Rcs.js +31 -41
- package/assets/svgIcons/Icons/Redirection.js +5 -15
- package/assets/svgIcons/Icons/Redis.js +46 -39
- package/assets/svgIcons/Icons/Referal.js +16 -34
- package/assets/svgIcons/Icons/Refresh.js +21 -15
- package/assets/svgIcons/Icons/RefreshCircle.js +24 -18
- package/assets/svgIcons/Icons/Reorder.js +28 -37
- package/assets/svgIcons/Icons/Reply.js +34 -29
- package/assets/svgIcons/Icons/Restore.js +22 -16
- package/assets/svgIcons/Icons/Retry.js +46 -36
- package/assets/svgIcons/Icons/Return.js +15 -14
- package/assets/svgIcons/Icons/Rewards.js +21 -15
- package/assets/svgIcons/Icons/RewardsOutline.js +23 -17
- package/assets/svgIcons/Icons/RichMessageNormal.js +22 -16
- package/assets/svgIcons/Icons/RichMessageSelected.js +22 -16
- package/assets/svgIcons/Icons/RichVideoNormal.js +33 -26
- package/assets/svgIcons/Icons/RichVideoSelected.js +33 -26
- package/assets/svgIcons/Icons/RightLeftArrow.js +22 -16
- package/assets/svgIcons/Icons/RightWrong.js +22 -16
- package/assets/svgIcons/Icons/Scenery.js +21 -15
- package/assets/svgIcons/Icons/Scope.js +30 -39
- package/assets/svgIcons/Icons/Search.js +15 -15
- package/assets/svgIcons/Icons/Send.js +21 -15
- package/assets/svgIcons/Icons/SendFilled.js +24 -21
- package/assets/svgIcons/Icons/Settings.js +21 -15
- package/assets/svgIcons/Icons/ShapeCopy.js +22 -16
- package/assets/svgIcons/Icons/Siren.js +28 -37
- package/assets/svgIcons/Icons/Sitemap.js +22 -16
- package/assets/svgIcons/Icons/SmallLink.js +25 -29
- package/assets/svgIcons/Icons/SmileyMessageNormal.js +26 -33
- package/assets/svgIcons/Icons/SmileyMessageSelected.js +22 -16
- package/assets/svgIcons/Icons/Sms.js +21 -15
- package/assets/svgIcons/Icons/SmsFilled.js +42 -58
- package/assets/svgIcons/Icons/Snapchat.js +41 -30
- package/assets/svgIcons/Icons/Sort.js +21 -15
- package/assets/svgIcons/Icons/SortUp.js +38 -40
- package/assets/svgIcons/Icons/Speaker.js +21 -15
- package/assets/svgIcons/Icons/Split.js +34 -24
- package/assets/svgIcons/Icons/SplitData.js +5 -16
- package/assets/svgIcons/Icons/Star.js +30 -39
- package/assets/svgIcons/Icons/Stop.js +21 -15
- package/assets/svgIcons/Icons/Store.js +22 -16
- package/assets/svgIcons/Icons/StoreTraffic.js +21 -15
- package/assets/svgIcons/Icons/SubtractLeft.js +27 -25
- package/assets/svgIcons/Icons/SubtractRight.js +18 -24
- package/assets/svgIcons/Icons/Sunset.js +24 -18
- package/assets/svgIcons/Icons/Survey.js +21 -15
- package/assets/svgIcons/Icons/SurveyBackground.js +51 -60
- package/assets/svgIcons/Icons/SurveyResponse.js +21 -15
- package/assets/svgIcons/Icons/Swap.js +22 -16
- package/assets/svgIcons/Icons/Sync.js +28 -37
- package/assets/svgIcons/Icons/Tablet.js +28 -37
- package/assets/svgIcons/Icons/Tag.js +15 -14
- package/assets/svgIcons/Icons/Target.js +22 -16
- package/assets/svgIcons/Icons/Task.js +15 -14
- package/assets/svgIcons/Icons/Test.js +20 -14
- package/assets/svgIcons/Icons/TestCheck.js +20 -14
- package/assets/svgIcons/Icons/TestComplete.js +8 -25
- package/assets/svgIcons/Icons/TestRunning.js +8 -23
- package/assets/svgIcons/Icons/TextMessageNormal.js +22 -16
- package/assets/svgIcons/Icons/TextMessageSelected.js +22 -16
- package/assets/svgIcons/Icons/ThreeStarDark.js +40 -32
- package/assets/svgIcons/Icons/ThreeStars.js +43 -43
- package/assets/svgIcons/Icons/Tick.js +15 -14
- package/assets/svgIcons/Icons/TickOutlined.js +24 -18
- package/assets/svgIcons/Icons/Tiktok.js +50 -38
- package/assets/svgIcons/Icons/TimerWarning.js +9 -40
- package/assets/svgIcons/Icons/Tooltip.js +24 -24
- package/assets/svgIcons/Icons/TopXChannel.js +28 -35
- package/assets/svgIcons/Icons/Trigger.js +22 -16
- package/assets/svgIcons/Icons/Trophy.js +11 -32
- package/assets/svgIcons/Icons/Unicode.js +28 -38
- package/assets/svgIcons/Icons/Union.js +18 -24
- package/assets/svgIcons/Icons/Upload.js +21 -15
- package/assets/svgIcons/Icons/User.js +21 -15
- package/assets/svgIcons/Icons/UserAttributechange.js +38 -41
- package/assets/svgIcons/Icons/UserCopy.js +39 -46
- package/assets/svgIcons/Icons/Viber.js +24 -30
- package/assets/svgIcons/Icons/Video.js +21 -15
- package/assets/svgIcons/Icons/View.js +15 -14
- package/assets/svgIcons/Icons/WaitEvent.js +53 -64
- package/assets/svgIcons/Icons/WalletBackground.js +52 -58
- package/assets/svgIcons/Icons/Warning.js +28 -37
- package/assets/svgIcons/Icons/WarningCircle.js +24 -18
- package/assets/svgIcons/Icons/WarningCircleFilled.js +33 -21
- package/assets/svgIcons/Icons/Webhook.js +20 -13
- package/assets/svgIcons/Icons/Wechat.js +21 -15
- package/assets/svgIcons/Icons/WechatFilled.js +42 -57
- package/assets/svgIcons/Icons/WechatOutline.js +30 -38
- package/assets/svgIcons/Icons/Whatsapp.js +21 -15
- package/assets/svgIcons/Icons/XEngage.js +35 -58
- package/assets/svgIcons/Icons/YetToStart.js +22 -16
- package/assets/svgIcons/Icons/Zalo.js +41 -33
- package/assets/svgIcons/Icons/abTesting.js +9 -36
- package/assets/svgIcons/Icons/index.js +4 -1
- package/assets/svgIcons/Icons/percentCircle.js +7 -15
- package/assets/svgIcons/Icons/sixDots.js +9 -32
- package/assets/svgIcons/component.js +950 -626
- package/assets/svgIcons/index.js +650 -324
- package/en.json +1 -296
- package/index.js +256 -129
- package/package.json +17 -13
- package/service/api.js +12 -22
- package/service/api.types.js +1 -1
- package/service/index.js +4 -1
- package/styled/index.d.ts +2 -1
- package/styled/index.d.ts.map +1 -1
- package/styled/index.js +149 -3
- package/styled/variables.d.ts +1 -0
- package/styled/variables.d.ts.map +1 -1
- package/styled/variables.js +149 -3
- package/styles/_variables.d.ts +155 -0
- package/styles/_variables.d.ts.map +1 -1
- package/styles/_variables.js +467 -197
- package/styles/datePickerCommon.css +77 -0
- package/styles/datePickerCommon.scss +32 -32
- package/translations/en.js +309 -306
- package/translations/index.js +6 -3
- package/translations/zh.js +43 -40
- package/utils/compileHandlebars.js +45 -55
- package/utils/dayjs.js +125 -287
- package/utils/dayjs.types.js +1 -1
- package/utils/fonts.js +58 -134
- package/utils/getCapThemeConfig.js +196 -250
- package/utils/index.js +14 -57
- package/utils/logDeprecationWarning.js +10 -6
- package/utils/styles.js +1 -21
- package/CapActionBar/tests/CapActionBar.mockData.js +0 -114
- package/CapActionBar/tests/CapActionBar.test.js +0 -353
- package/CapAdvancedIcon/tests/index.test.js +0 -550
- package/CapAdvancedIcon/tests/mockData.js +0 -55
- package/CapAlert/tests/CapAlert.test.js +0 -467
- package/CapAppNotEnabled/tests/CapAppNotEnabled.mockData.js +0 -10
- package/CapAppNotEnabled/tests/CapAppNotEnabled.test.js +0 -178
- package/CapAskAira/AudienceFilterBot/tests/index.test.js +0 -1193
- package/CapAskAira/CapAiMediaGeneration/test/api.test.js +0 -43
- package/CapAskAira/CapAiMediaGeneration/test/index.test.js +0 -204
- package/CapAskAira/CapAiMediaGeneration/test/reducer.test.js +0 -33
- package/CapAskAira/CapAiMediaGeneration/test/saga.test.js +0 -59
- package/CapAskAira/CapAiMediaGeneration/test/selector.test.js +0 -73
- package/CapAskAira/ConfigurationBot/test/PromptAttachmentButton.test.js +0 -96
- package/CapAskAira/ConfigurationBot/test/index.test.js +0 -357
- package/CapAskAira/ConfigurationBot/test/util.test.js +0 -32
- package/CapAskAira/ContentGenerationBot/tests/index.test.js +0 -158
- package/CapAskAira/ContentGenerationBot/tests/jsonAssembler.test.js +0 -96
- package/CapAskAira/DocumentationBot/test/UtilComponents.test.js +0 -113
- package/CapAskAira/DocumentationBot/test/index.test.js +0 -153
- package/CapAskAira/DocumentationChatBot/test/api.test.js +0 -49
- package/CapAskAira/DocumentationChatBot/test/index.test.js +0 -164
- package/CapAskAira/DocumentationChatBot/test/reducer.test.js +0 -28
- package/CapAskAira/DocumentationChatBot/test/saga.test.js +0 -59
- package/CapAskAira/DocumentationChatBot/test/selector.test.js +0 -73
- package/CapAskAira/RuleGenerationBot/tests/actions.test.js +0 -40
- package/CapAskAira/RuleGenerationBot/tests/api.test.js +0 -95
- package/CapAskAira/RuleGenerationBot/tests/index.test.js +0 -136
- package/CapAskAira/RuleGenerationBot/tests/reducer.test.js +0 -137
- package/CapAskAira/RuleGenerationBot/tests/saga.test.js +0 -110
- package/CapAskAira/RuleGenerationBot/tests/selector.test.js +0 -82
- package/CapAskAira/RuleSummarizationBot/tests/actions.test.js +0 -82
- package/CapAskAira/RuleSummarizationBot/tests/api.test.js +0 -147
- package/CapAskAira/RuleSummarizationBot/tests/index.test.js +0 -134
- package/CapAskAira/RuleSummarizationBot/tests/mockData.js +0 -54
- package/CapAskAira/RuleSummarizationBot/tests/reducer.test.js +0 -158
- package/CapAskAira/RuleSummarizationBot/tests/saga.test.js +0 -206
- package/CapAskAira/RuleSummarizationBot/tests/selector.test.js +0 -82
- package/CapAskAira/UtilComponents/tests/AiraContainer.test.js +0 -168
- package/CapAskAira/UtilComponents/tests/ErrorBar.test.js +0 -48
- package/CapAskAira/UtilComponents/tests/MultiLineInpuxBox.test.js +0 -158
- package/CapAskAira/UtilComponents/tests/Notification.test.js +0 -44
- package/CapAskAira/UtilComponents/tests/Popup.test.js +0 -176
- package/CapAskAira/UtilComponents/tests/Tooltip.test.js +0 -32
- package/CapAskAira/tests/CapAskAira.mockData.js +0 -25
- package/CapAskAira/tests/CapAskAira.test.js +0 -91
- package/CapAskAira/tests/util.test.js +0 -124
- package/CapBanner/tests/CapBanner.mockData.js +0 -54
- package/CapBanner/tests/CapBanner.test.js +0 -64
- package/CapBlock/tests/index.test.js +0 -279
- package/CapBorderedBox/tests/CapBorderedBox.mockData.js +0 -95
- package/CapBorderedBox/tests/index.test.js +0 -314
- package/CapButton/tests/CapButton.mockData.js +0 -19
- package/CapButton/tests/CapButton.test.js +0 -664
- package/CapButton/tests/index.test.js +0 -201
- package/CapCSVFileUploader/tests/CapCSVFileUploader.mockData.js +0 -99
- package/CapCSVFileUploader/tests/CapCSVFileUploader.test.js +0 -458
- package/CapCalendarDatePicker/tests/index.test.js +0 -91
- package/CapCard/tests/CapCard.mockData.js +0 -88
- package/CapCard/tests/index.test.js +0 -772
- package/CapCardBox/tests/CapCardBox.mockData.js +0 -101
- package/CapCardBox/tests/CapCardBox.test.js +0 -543
- package/CapCarousel/tests/CapCarousel.mockData.js +0 -62
- package/CapCarousel/tests/CapCarousel.test.js +0 -743
- package/CapCheckbox/tests/CapCheckbox.test.js +0 -1012
- package/CapCheckbox/tests/index.test.js +0 -143
- package/CapCollapsibleNavbar/tests/index.test.js +0 -54
- package/CapColorPicker/tests/CapColorPicker.mockData.js +0 -21
- package/CapColorPicker/tests/CapColorPicker.test.js +0 -344
- package/CapColoredTag/tests/CapColoredTag.mockData.js +0 -74
- package/CapColoredTag/tests/CapColoredTag.test.js +0 -323
- package/CapColumn/tests/index.test.js +0 -92
- package/CapCondition/tests/ConditionCustomField.test.js +0 -333
- package/CapCondition/tests/ConditionDate.test.js +0 -1982
- package/CapCondition/tests/ConditionMultiSelect.test.js +0 -48
- package/CapCondition/tests/ConditionMultiSelectTree.test.js +0 -49
- package/CapCondition/tests/helper.test.js +0 -686
- package/CapCondition/tests/index.test.js +0 -1116
- package/CapConditionPreview/tests/index.test.js +0 -1501
- package/CapConditionPreview/tests/mockData.js +0 -42
- package/CapCustomCard/tests/CapCustomCard.mockData.js +0 -309
- package/CapCustomCard/tests/CapCustomCard.test.js +0 -1079
- package/CapCustomCarousel/tests/index.test.js +0 -102
- package/CapCustomCheckboxList/tests/CapCustomCheckboxList.mockData.js +0 -139
- package/CapCustomCheckboxList/tests/CapCustomCheckboxList.test.js +0 -547
- package/CapCustomList/tests/CapCustomList.mockData.js +0 -62
- package/CapCustomList/tests/CapCustomList.test.js +0 -264
- package/CapCustomSelect/tests/index.test.js +0 -509
- package/CapDatePicker/tests/index.test.js +0 -421
- package/CapDateRangePicker/tests/CapDateRangePicker.compatibility.test.js +0 -292
- package/CapDateRangePicker/tests/CapDateRangePicker.mockData.js +0 -17
- package/CapDateRangePicker/tests/CapDateRangePicker.test.js +0 -287
- package/CapDateRangePicker/tests/CapDateRangePicker.testUtils.js +0 -26
- package/CapDateTimePicker/tests/index.test.js +0 -244
- package/CapDateTimeRangePicker/tests/CapDateTimeRangePicker.test.js +0 -405
- package/CapDateTimeRangePicker/tests/index.test.js +0 -1557
- package/CapDivider/tests/CapDivider.mockData.js +0 -158
- package/CapDivider/tests/index.test.js +0 -618
- package/CapDnDGraph/tests/utils.test.js +0 -72
- package/CapDndGraphSidebar/tests/index.test.js +0 -139
- package/CapDndGraphSidebar/tests/sideBarIcon.test.js +0 -77
- package/CapDragReorder/tests/index.test.js +0 -47
- package/CapDrawer/tests/CapDrawer.mockData.js +0 -135
- package/CapDrawer/tests/CapDrawer.test.js +0 -313
- package/CapDropdown/tests/CapDropdown.mockData.js +0 -89
- package/CapDropdown/tests/CapDropdown.test.js +0 -1134
- package/CapDropdown/tests/index.test.js +0 -154
- package/CapEmptyDivWithBorder/tests/CapEmptyDivWithBorder.mockData.js +0 -92
- package/CapEmptyDivWithBorder/tests/CapEmptyDivWithBorder.test.js +0 -446
- package/CapError/tests/CapError.mockData.js +0 -45
- package/CapError/tests/index.test.js +0 -536
- package/CapErrorBoundary/tests/CapErrorBoundary.mockData.js +0 -46
- package/CapErrorBoundary/tests/CapErrorBoundary.test.js +0 -493
- package/CapErrorStateIllustration/tests/CapErrorStateIllustration.mockData.js +0 -58
- package/CapErrorStateIllustration/tests/CapErrorStateIllustration.test.js +0 -294
- package/CapEventCalendar/tests/CalendarCanvas.test.js +0 -235
- package/CapEventCalendar/tests/CalendarCanvasUtils.test.js +0 -137
- package/CapEventCalendar/tests/CapEventCalendar.test.js +0 -123
- package/CapEventCalendar/tests/utils.test.js +0 -14
- package/CapExpressionEditor/js/fixGrammar.test.js +0 -221
- package/CapExpressionEditor/js/pickers.test.js +0 -153
- package/CapExpressionEditor/tests/CapExpressionEditor.mockData.js +0 -24
- package/CapExpressionEditor/tests/CapExpressionEditor.test.js +0 -354
- package/CapForm/tests/CapForm.mockData.js +0 -94
- package/CapForm/tests/CapForm.test.js +0 -684
- package/CapForm/tests/index.test.js +0 -118
- package/CapFormItem/tests/CapFormItem.mockData.js +0 -63
- package/CapFormItem/tests/index.test.js +0 -649
- package/CapGraph/tests/CapGraph.mockData.js +0 -45
- package/CapGraph/tests/index.test.js +0 -119
- package/CapHamburgerMenu/tests/CapHamburgerMenu.mockData.js +0 -123
- package/CapHamburgerMenu/tests/index.test.js +0 -657
- package/CapHeader/tests/index.test.js +0 -334
- package/CapHeading/tests/CapHeading.mockData.js +0 -72
- package/CapHeading/tests/CapHeading.test.js +0 -677
- package/CapHeading/tests/index.test.js +0 -657
- package/CapHierarchyComponent/tests/index.test.js +0 -84
- package/CapIcon/tests/index.test.js +0 -366
- package/CapIllustration/tests/CapIllustration.mockData.js +0 -74
- package/CapIllustration/tests/index.test.js +0 -244
- package/CapImage/tests/CapImage.mockData.js +0 -54
- package/CapImage/tests/index.test.js +0 -234
- package/CapImportMFEComponent/tests/CapImportMFEComponent.mockData.js +0 -61
- package/CapImportMFEComponent/tests/CapImportMFEComponent.test.js +0 -64
- package/CapInfoNote/tests/CapInfoNote.mockData.js +0 -50
- package/CapInfoNote/tests/index.test.js +0 -379
- package/CapInput/tests/CapInput.mockData.js +0 -90
- package/CapInput/tests/CapInput.test.js +0 -796
- package/CapInput/tests/Number.test.js +0 -139
- package/CapInput/tests/Search.test.js +0 -133
- package/CapInput/tests/TextArea.test.js +0 -152
- package/CapInput/tests/index.test.js +0 -149
- package/CapInput/tests/messages.test.js +0 -33
- package/CapLabel/tests/CapLabel.mockData.js +0 -74
- package/CapLabel/tests/CapLabel.test.js +0 -621
- package/CapLabel/tests/index.test.js +0 -194
- package/CapLanguageProvider/index.d.js +0 -1
- package/CapLanguageProvider/tests/CapLanguageProvider.mockData.js +0 -52
- package/CapLanguageProvider/tests/CapLanguageProvider.test.js +0 -405
- package/CapLanguageProvider/tests/CapLanguageProvider.testHelpers.js +0 -61
- package/CapLanguageProvider/tests/CapLanguageProvider.useCases.test.js +0 -350
- package/CapLanguageProvider/tests/actions.test.js +0 -104
- package/CapLanguageProvider/tests/index.test.js +0 -164
- package/CapLanguageProvider/tests/locale.test.js +0 -20
- package/CapLanguageProvider/tests/reducer.test.js +0 -187
- package/CapLanguageProvider/tests/saga.test.js +0 -174
- package/CapLanguageProvider/tests/selector.test.js +0 -122
- package/CapLevelGraphRenderer/tests/CapLevelGraphRenderer.mockData.js +0 -182
- package/CapLevelGraphRenderer/tests/CapLevelGraphRenderer.test.js +0 -522
- package/CapLevelGraphRenderer/tests/Tooltip.test.js +0 -123
- package/CapLink/tests/CapLink.mockData.js +0 -65
- package/CapLink/tests/index.test.js +0 -141
- package/CapList/tests/CapList.mockData.js +0 -33
- package/CapList/tests/CapList.test.js +0 -657
- package/CapListLayout/tests/CapListLayout.mockData.js +0 -43
- package/CapListLayout/tests/CapListLayout.test.js +0 -50
- package/CapLogin/tests/CapLogin.mockData.js +0 -55
- package/CapLogin/tests/CapLogin.test.js +0 -194
- package/CapMediaPreview/tests/index.test.js +0 -127
- package/CapMediaPreview/tests/mockData.js +0 -17
- package/CapMenu/tests/CapMenu.mockData.js +0 -132
- package/CapMenu/tests/CapMenu.test.js +0 -454
- package/CapMenu/tests/index.test.js +0 -171
- package/CapMobileDatePicker/tests/index.test.js +0 -11
- package/CapModal/tests/CapModal.mockData.js +0 -62
- package/CapModal/tests/index.test.js +0 -456
- package/CapMultiSelect/tests/CapMultiSelect.mockData.js +0 -44
- package/CapMultiSelect/tests/index.test.js +0 -219
- package/CapMultiSelectDatePicker/tests/index.test.js +0 -23
- package/CapMultiSelectWithTree/tests/index.test.js +0 -422
- package/CapMultiplePath/tests/index.test.js +0 -382
- package/CapNavigation/tests/CapNavigation.mockData.js +0 -96
- package/CapNavigation/tests/CapNavigation.test.js +0 -498
- package/CapNavigation/tests/index.test.js +0 -229
- package/CapNotification/tests/CapNotification.mockData.js +0 -35
- package/CapNotification/tests/index.test.js +0 -137
- package/CapNotificationDropdown/tests/CapNotificationDropdown.mockData.js +0 -121
- package/CapNotificationDropdown/tests/CapNotificationDropdown.test.js +0 -344
- package/CapPopover/tests/CapPopover.mockData.js +0 -35
- package/CapPopover/tests/index.test.js +0 -165
- package/CapPopoverTree/tests/index.test.js +0 -119
- package/CapPopoverTree/tests/mockData.js +0 -37
- package/CapProgress/tests/CapProgress.mockData.js +0 -121
- package/CapProgress/tests/index.test.js +0 -216
- package/CapRadio/tests/index.test.js +0 -159
- package/CapRadioButton/tests/CapRadioButton.mockData.js +0 -44
- package/CapRadioButton/tests/index.test.js +0 -494
- package/CapRadioCard/tests/CapRadioCard.mockData.js +0 -116
- package/CapRadioCard/tests/index.test.js +0 -148
- package/CapRadioGroup/tests/CapRadioGroup.mockData.js +0 -117
- package/CapRadioGroup/tests/index.test.js +0 -391
- package/CapReorderComponent/tests/CapReorderComponent.mockData.js +0 -48
- package/CapReorderComponent/tests/index.test.js +0 -841
- package/CapRoadMap/tests/CapRoadMap.mockData.js +0 -74
- package/CapRoadMap/tests/CapRoadMap.test.js +0 -159
- package/CapRow/tests/index.test.js +0 -383
- package/CapSKUUploader/tests/CapSKUUploader.mockData.js +0 -106
- package/CapSKUUploader/tests/CapSKUUploader.test.js +0 -414
- package/CapSecondaryTopBar/tests/CapSecondaryTopBar.mockData.js +0 -144
- package/CapSecondaryTopBar/tests/index.test.js +0 -148
- package/CapSelect/tests/CapSelect.mockData.js +0 -61
- package/CapSelect/tests/index.test.js +0 -447
- package/CapSelectFilter/tests/CapSelectFilter.mockData.js +0 -40
- package/CapSelectFilter/tests/index.test.js +0 -330
- package/CapShape/tests/CapShape.mockData.js +0 -36
- package/CapShape/tests/index.test.js +0 -482
- package/CapSideBar/tests/CapSideBar.mockData.js +0 -209
- package/CapSideBar/tests/MenuSearch.test.js +0 -304
- package/CapSideBar/tests/index.test.js +0 -324
- package/CapSkeleton/tests/index.test.js +0 -128
- package/CapSlideBox/tests/CapSlideBox.mockData.js +0 -65
- package/CapSlideBox/tests/CapSlideBox.test.js +0 -494
- package/CapSlider/tests/CapSlider.mockData.js +0 -35
- package/CapSlider/tests/index.test.js +0 -428
- package/CapSnackBar/tests/CapSnackBar.mockData.js +0 -51
- package/CapSnackBar/tests/CapSnackBar.test.js +0 -364
- package/CapSomethingWentWrong/tests/CapSomethingWentWrong.mockData.js +0 -27
- package/CapSomethingWentWrong/tests/CapSomethingWentWrong.test.js +0 -87
- package/CapSpin/tests/index.test.js +0 -113
- package/CapSplit/tests/index.test.js +0 -80
- package/CapSplit/tests/mockData.js +0 -62
- package/CapStaticTemplates/tests/index.test.js +0 -119
- package/CapStaticTemplates/tests/mockData.js +0 -39
- package/CapStatisticCard/tests/CapStatisticCard.mockData.js +0 -26
- package/CapStatisticCard/tests/CapStatisticCard.test.js +0 -104
- package/CapStatus/tests/CapStatus.mockData.js +0 -56
- package/CapStatus/tests/CapStatus.test.js +0 -298
- package/CapSteps/tests/CapSteps.mockData.js +0 -71
- package/CapSteps/tests/index.test.js +0 -157
- package/CapStepsAccordian/tests/CapStepsAccordian.mockData.js +0 -145
- package/CapStepsAccordian/tests/CapStepsAccordian.test.js +0 -587
- package/CapStepsAccordian/tests/index.test.js +0 -43
- package/CapSupportVideosWrapper/tests/ResizablePIP.test.js +0 -460
- package/CapSupportVideosWrapper/tests/index.test.js +0 -148
- package/CapSupportVideosWrapper/tests/utils.test.js +0 -40
- package/CapSwitch/tests/index.test.js +0 -119
- package/CapTab/tests/CapTab.mockData.js +0 -89
- package/CapTab/tests/CapTab.test.js +0 -1168
- package/CapTab/tests/index.test.js +0 -223
- package/CapTabV3/tests/CapTabV3.mockData.js +0 -190
- package/CapTabV3/tests/CapTabV3.test.js +0 -586
- package/CapTabV3/tests/index.test.js +0 -29
- package/CapTable/tests/CapTable.mockData.js +0 -49
- package/CapTable/tests/CapTable.test.js +0 -622
- package/CapTable/tests/index.test.js +0 -331
- package/CapTable/tests/loadable.test.js +0 -35
- package/CapTag/tests/CapTag.mockData.js +0 -22
- package/CapTag/tests/index.test.js +0 -67
- package/CapTagDropdown/tests/index.test.js +0 -236
- package/CapTimePicker/tests/CapTimePicker.mockData.js +0 -54
- package/CapTimePicker/tests/index.test.js +0 -133
- package/CapTimeline/tests/CapTimelineCard.test.js +0 -137
- package/CapTimeline/tests/CapTimelinePanesWrapper.test.js +0 -78
- package/CapTimeline/tests/index.test.js +0 -47
- package/CapTimelineNested/tests/CapTimelineCard.test.js +0 -132
- package/CapTimelineNested/tests/CapTimelinePanesWrapper.test.js +0 -52
- package/CapTimelineNested/tests/NestedCard.test.js +0 -56
- package/CapTimelineNested/tests/NestedCardParent.test.js +0 -65
- package/CapTimelineNested/tests/index.test.js +0 -64
- package/CapTimelineNested/tests/mockData.js +0 -137
- package/CapTooltip/tests/index.test.js +0 -287
- package/CapTooltipWithInfo/tests/CapTooltipWithInfo.mockData.js +0 -76
- package/CapTooltipWithInfo/tests/index.test.js +0 -496
- package/CapTopBar/tests/index.test.js +0 -635
- package/CapTopBar/tests/utils.test.js +0 -183
- package/CapTree/tests/CapTree.mockData.js +0 -81
- package/CapTree/tests/CapTree.test.js +0 -544
- package/CapTreeSelect/tests/CapTreeSelect.mockData.js +0 -131
- package/CapTreeSelect/tests/index.test.js +0 -351
- package/CapTreeView/tests/index.test.js +0 -72
- package/CapTruncateList/tests/CapTruncateList.mockData.js +0 -8
- package/CapTruncateList/tests/CapTruncateList.test.js +0 -250
- package/CapUnifiedSelect/tests/index.test.js +0 -2988
- package/CapUploader/tests/CapUploader.mockData.js +0 -139
- package/CapUploader/tests/CapUploader.test.js +0 -449
- package/CapUserProfile/tests/CapUserProfile.mockData.js +0 -60
- package/CapUserProfile/tests/CapUserProfile.test.js +0 -421
- package/CapUserProfile/tests/UserProfileTab.test.js +0 -308
- package/CapUserProfile/tests/index.test.js +0 -122
- package/CapUserProfile/tests/utils.test.js +0 -362
- package/CapVerticalGroupTable/tests/index.test.js +0 -70
- package/CapVirtualList/tests/index.test.js +0 -94
- package/CapVirtualSelect/tests/index.test.js +0 -211
- package/CapVirtualSelect/tests/mockData.js +0 -51
- package/CapVirtualSelect/tests/reducer.test.js +0 -266
- package/CapVirtualSelect/tests/saga.test.js +0 -256
- package/CapVirtualSelect/tests/selector.test.js +0 -73
- package/CapVirtualSelect/tests/utils.test.js +0 -42
- package/LocaleHoc/tests/index.test.js +0 -41
- package/assets/svgIcons/Icons/tests/icons.test.js +0 -30
- package/assets/svgIcons/index.d.js +0 -0
- package/assets/svgIcons/tests/component.test.js +0 -252
- package/service/tests/api.test.js +0 -88
- package/styles.d.js +0 -0
- package/translations/en.d.js +0 -1
- package/utils/fonts.test.js +0 -84
- package/utils/tests/dayjs.test.js +0 -1341
|
@@ -1,2988 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
|
-
import { render, screen, waitFor, within, act, cleanup } from '@testing-library/react';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
/* eslint-disable max-lines */
|
|
7
|
-
|
|
8
|
-
import { DEFAULTS, SELECT_TYPES } from "../constants";
|
|
9
|
-
import CapUnifiedSelect from "../index";
|
|
10
|
-
import { mockOptions, mockTreeOptions, mockTreeOptionsWithMixed, mockAsyncResults, mockAsyncResultsForCache, mockAsyncResultsForResetSearch, mockSimpleAsyncResult, mockInitialOptions, mockNewOptions, getMockOptionsWithReactTitle } from "../testData";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
describe('CapUnifiedSelect', () => {
|
|
13
|
-
var options = mockOptions;
|
|
14
|
-
var treeOptions = mockTreeOptions;
|
|
15
|
-
describe('Basic Rendering', () => {
|
|
16
|
-
it('should render select component with placeholder', () => {
|
|
17
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
18
|
-
options: options,
|
|
19
|
-
placeholder: "Select option"
|
|
20
|
-
}));
|
|
21
|
-
expect(screen.getByText('Select option')).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
it('should display selected value', () => {
|
|
24
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
25
|
-
options: options,
|
|
26
|
-
value: "1"
|
|
27
|
-
}));
|
|
28
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
it('should render with header label', () => {
|
|
31
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
32
|
-
options: options,
|
|
33
|
-
headerLabel: "Select Header"
|
|
34
|
-
}));
|
|
35
|
-
expect(screen.getByText('Select Header')).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('Single Selection', () => {
|
|
39
|
-
it('should handle user selection and call onChange with correct value', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
40
|
-
var handleChange = jest.fn();
|
|
41
|
-
var user = userEvent.setup();
|
|
42
|
-
var {
|
|
43
|
-
container
|
|
44
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
45
|
-
options: options,
|
|
46
|
-
onChange: handleChange,
|
|
47
|
-
placeholder: "Select",
|
|
48
|
-
customPopupRender: false
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
// Verify component rendered
|
|
52
|
-
expect(screen.getByText('Select')).toBeInTheDocument();
|
|
53
|
-
|
|
54
|
-
// In Ant Design v5, use .ant-select-content (container) or .ant-select (outer) for clicking
|
|
55
|
-
var selector = container.querySelector('.ant-select-content') || container.querySelector('.ant-select');
|
|
56
|
-
expect(selector).toBeTruthy();
|
|
57
|
-
expect(selector).toBeInTheDocument();
|
|
58
|
-
yield user.click(selector);
|
|
59
|
-
yield waitFor(() => {
|
|
60
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
61
|
-
});
|
|
62
|
-
yield user.click(screen.getByText('Option 1'));
|
|
63
|
-
expect(handleChange).toHaveBeenCalled();
|
|
64
|
-
expect(handleChange.mock.calls[0][0]).toBe('1');
|
|
65
|
-
}));
|
|
66
|
-
it('should display selected option after selection', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
67
|
-
var user = userEvent.setup();
|
|
68
|
-
var {
|
|
69
|
-
container
|
|
70
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
71
|
-
options: options,
|
|
72
|
-
placeholder: "Select",
|
|
73
|
-
customPopupRender: false
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
|
-
// Verify component rendered
|
|
77
|
-
expect(screen.getByText('Select')).toBeInTheDocument();
|
|
78
|
-
|
|
79
|
-
// In Ant Design v5, use .ant-select-content (container) or .ant-select (outer) for clicking
|
|
80
|
-
var selector = container.querySelector('.ant-select-content') || container.querySelector('.ant-select');
|
|
81
|
-
expect(selector).toBeTruthy();
|
|
82
|
-
expect(selector).toBeInTheDocument();
|
|
83
|
-
yield user.click(selector);
|
|
84
|
-
yield waitFor(() => {
|
|
85
|
-
var options = screen.getAllByText('Option 2');
|
|
86
|
-
expect(options.length).toBeGreaterThan(0);
|
|
87
|
-
});
|
|
88
|
-
var optionElements = screen.getAllByText('Option 2');
|
|
89
|
-
yield user.click(optionElements[0]);
|
|
90
|
-
yield user.click(selector);
|
|
91
|
-
yield waitFor(() => {
|
|
92
|
-
var container = document.querySelector('.cap-unified-select-container');
|
|
93
|
-
expect(within(container).getByText('Option 2')).toBeInTheDocument();
|
|
94
|
-
});
|
|
95
|
-
}));
|
|
96
|
-
});
|
|
97
|
-
describe('Multi Selection', () => {
|
|
98
|
-
it('should display multiple selected values', () => {
|
|
99
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
100
|
-
options: options,
|
|
101
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
102
|
-
value: ['1', '2']
|
|
103
|
-
}));
|
|
104
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
105
|
-
});
|
|
106
|
-
it('should show "+X more" indicator for multiple selections', () => {
|
|
107
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
108
|
-
options: options,
|
|
109
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
110
|
-
value: ['1', '2', '3']
|
|
111
|
-
}));
|
|
112
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
113
|
-
expect(screen.getByText('+2 more')).toBeInTheDocument();
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
describe('Select All Checkbox', () => {
|
|
117
|
-
it('should select all leaf values when checkbox is checked with empty tempValue', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
118
|
-
var handleChange = jest.fn();
|
|
119
|
-
var user = userEvent.setup();
|
|
120
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
121
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
122
|
-
options: options,
|
|
123
|
-
onChange: handleChange,
|
|
124
|
-
customPopupRender: true,
|
|
125
|
-
staticValue: true
|
|
126
|
-
}));
|
|
127
|
-
var selector = document.querySelector('.ant-select-content');
|
|
128
|
-
expect(selector).toBeTruthy();
|
|
129
|
-
yield user.click(selector);
|
|
130
|
-
yield waitFor(() => {
|
|
131
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
132
|
-
});
|
|
133
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
134
|
-
if (selectAllCheckbox) {
|
|
135
|
-
yield user.click(selectAllCheckbox);
|
|
136
|
-
var confirmButton = screen.getByText('Confirm');
|
|
137
|
-
yield user.click(confirmButton);
|
|
138
|
-
expect(handleChange).toHaveBeenCalled();
|
|
139
|
-
var selectedValues = handleChange.mock.calls[0][0];
|
|
140
|
-
expect(Array.isArray(selectedValues)).toBe(true);
|
|
141
|
-
expect(selectedValues).toHaveLength(3);
|
|
142
|
-
expect(selectedValues).toContain('1');
|
|
143
|
-
expect(selectedValues).toContain('2');
|
|
144
|
-
expect(selectedValues).toContain('3');
|
|
145
|
-
}
|
|
146
|
-
}));
|
|
147
|
-
it('should merge existing selections when checkbox is checked with partial tempValue', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
148
|
-
var handleChange = jest.fn();
|
|
149
|
-
var user = userEvent.setup();
|
|
150
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
151
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
152
|
-
options: options,
|
|
153
|
-
value: ['1'],
|
|
154
|
-
onChange: handleChange,
|
|
155
|
-
customPopupRender: true,
|
|
156
|
-
staticValue: true
|
|
157
|
-
}));
|
|
158
|
-
var selector = document.querySelector('.ant-select-content');
|
|
159
|
-
expect(selector).toBeTruthy();
|
|
160
|
-
yield user.click(selector);
|
|
161
|
-
yield waitFor(() => {
|
|
162
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
163
|
-
});
|
|
164
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
165
|
-
if (selectAllCheckbox) {
|
|
166
|
-
yield user.click(selectAllCheckbox);
|
|
167
|
-
var confirmButton = screen.getByText('Confirm');
|
|
168
|
-
yield user.click(confirmButton);
|
|
169
|
-
expect(handleChange).toHaveBeenCalled();
|
|
170
|
-
var selectedValues = handleChange.mock.calls[0][0];
|
|
171
|
-
expect(Array.isArray(selectedValues)).toBe(true);
|
|
172
|
-
expect(selectedValues).toHaveLength(3);
|
|
173
|
-
expect(selectedValues).toContain('1');
|
|
174
|
-
expect(selectedValues).toContain('2');
|
|
175
|
-
expect(selectedValues).toContain('3');
|
|
176
|
-
}
|
|
177
|
-
}));
|
|
178
|
-
it('should deselect all leaf values when checkbox is unchecked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
179
|
-
var handleChange = jest.fn();
|
|
180
|
-
var user = userEvent.setup();
|
|
181
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
182
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
183
|
-
options: options,
|
|
184
|
-
value: ['1', '2', '3'],
|
|
185
|
-
onChange: handleChange,
|
|
186
|
-
customPopupRender: true,
|
|
187
|
-
staticValue: true
|
|
188
|
-
}));
|
|
189
|
-
var selector = document.querySelector('.ant-select-content');
|
|
190
|
-
expect(selector).toBeTruthy();
|
|
191
|
-
yield user.click(selector);
|
|
192
|
-
yield waitFor(() => {
|
|
193
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
194
|
-
});
|
|
195
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
196
|
-
if (selectAllCheckbox) {
|
|
197
|
-
var checkbox = selectAllCheckbox.querySelector('.ant-checkbox');
|
|
198
|
-
expect(checkbox).toHaveClass('ant-checkbox-checked');
|
|
199
|
-
yield user.click(selectAllCheckbox);
|
|
200
|
-
yield waitFor(() => {
|
|
201
|
-
var updatedCheckbox = selectAllCheckbox.querySelector('.ant-checkbox');
|
|
202
|
-
expect(updatedCheckbox).not.toHaveClass('ant-checkbox-checked');
|
|
203
|
-
expect(updatedCheckbox).not.toHaveClass('ant-checkbox-indeterminate');
|
|
204
|
-
});
|
|
205
|
-
yield waitFor(() => {
|
|
206
|
-
var confirmButton = screen.getByText('Confirm').closest('button');
|
|
207
|
-
expect(confirmButton).toBeInTheDocument();
|
|
208
|
-
expect(confirmButton).toBeDisabled();
|
|
209
|
-
});
|
|
210
|
-
yield user.click(screen.getByText('Option 1'));
|
|
211
|
-
yield waitFor(() => {
|
|
212
|
-
var confirmButton = screen.getByText('Confirm').closest('button');
|
|
213
|
-
expect(confirmButton).toBeInTheDocument();
|
|
214
|
-
expect(confirmButton).not.toBeDisabled();
|
|
215
|
-
});
|
|
216
|
-
var confirmButton = screen.getByText('Confirm').closest('button');
|
|
217
|
-
if (confirmButton) {
|
|
218
|
-
yield user.click(confirmButton);
|
|
219
|
-
}
|
|
220
|
-
expect(handleChange).toHaveBeenCalled();
|
|
221
|
-
var selectedValues = handleChange.mock.calls[0][0];
|
|
222
|
-
expect(Array.isArray(selectedValues)).toBe(true);
|
|
223
|
-
expect(selectedValues).toHaveLength(1);
|
|
224
|
-
expect(selectedValues).toContain('1');
|
|
225
|
-
expect(selectedValues).not.toContain('2');
|
|
226
|
-
expect(selectedValues).not.toContain('3');
|
|
227
|
-
}
|
|
228
|
-
}));
|
|
229
|
-
it('should preserve values not in leafValues when checkbox is unchecked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
230
|
-
var handleChange = jest.fn();
|
|
231
|
-
var user = userEvent.setup();
|
|
232
|
-
var treeOptionsWithMixed = mockTreeOptionsWithMixed;
|
|
233
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
234
|
-
type: SELECT_TYPES.MULTI_TREE_SELECT,
|
|
235
|
-
options: treeOptionsWithMixed,
|
|
236
|
-
value: ['child1', 'child2', 'parent1'],
|
|
237
|
-
onChange: handleChange,
|
|
238
|
-
customPopupRender: true,
|
|
239
|
-
staticValue: true
|
|
240
|
-
}));
|
|
241
|
-
var selector = document.querySelector('.ant-select-content');
|
|
242
|
-
expect(selector).toBeTruthy();
|
|
243
|
-
yield user.click(selector);
|
|
244
|
-
yield waitFor(() => {
|
|
245
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
246
|
-
});
|
|
247
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
248
|
-
if (selectAllCheckbox) {
|
|
249
|
-
yield user.click(selectAllCheckbox);
|
|
250
|
-
var confirmButton = screen.getByText('Confirm');
|
|
251
|
-
yield user.click(confirmButton);
|
|
252
|
-
expect(handleChange).toHaveBeenCalled();
|
|
253
|
-
var selectedValues = handleChange.mock.calls[0][0];
|
|
254
|
-
expect(Array.isArray(selectedValues)).toBe(true);
|
|
255
|
-
expect(selectedValues).not.toContain('child1');
|
|
256
|
-
expect(selectedValues).not.toContain('child2');
|
|
257
|
-
}
|
|
258
|
-
}));
|
|
259
|
-
it('should handle select all with tree structure correctly', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
260
|
-
var handleChange = jest.fn();
|
|
261
|
-
var user = userEvent.setup();
|
|
262
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
263
|
-
type: SELECT_TYPES.MULTI_TREE_SELECT,
|
|
264
|
-
options: treeOptions,
|
|
265
|
-
onChange: handleChange,
|
|
266
|
-
customPopupRender: true,
|
|
267
|
-
staticValue: true
|
|
268
|
-
}));
|
|
269
|
-
var selector = document.querySelector('.ant-select-content');
|
|
270
|
-
expect(selector).toBeTruthy();
|
|
271
|
-
yield user.click(selector);
|
|
272
|
-
yield waitFor(() => {
|
|
273
|
-
expect(screen.getByText('Parent 1')).toBeInTheDocument();
|
|
274
|
-
});
|
|
275
|
-
var switcher = document.querySelector('.ant-select-tree-switcher');
|
|
276
|
-
if (switcher) {
|
|
277
|
-
yield user.click(switcher);
|
|
278
|
-
}
|
|
279
|
-
yield waitFor(() => {
|
|
280
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
281
|
-
});
|
|
282
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
283
|
-
if (selectAllCheckbox) {
|
|
284
|
-
yield user.click(selectAllCheckbox);
|
|
285
|
-
var confirmButton = screen.getByText('Confirm');
|
|
286
|
-
yield user.click(confirmButton);
|
|
287
|
-
expect(handleChange).toHaveBeenCalled();
|
|
288
|
-
var selectedValues = handleChange.mock.calls[0][0];
|
|
289
|
-
expect(Array.isArray(selectedValues)).toBe(true);
|
|
290
|
-
expect(selectedValues).toContain('child1');
|
|
291
|
-
expect(selectedValues).toContain('child2');
|
|
292
|
-
expect(selectedValues).toContain('child3');
|
|
293
|
-
}
|
|
294
|
-
}));
|
|
295
|
-
it('should show indeterminate state when some but not all items are selected', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
296
|
-
var user = userEvent.setup();
|
|
297
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
298
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
299
|
-
options: options,
|
|
300
|
-
value: ['1', '2'],
|
|
301
|
-
customPopupRender: true,
|
|
302
|
-
staticValue: true
|
|
303
|
-
}));
|
|
304
|
-
var selector = document.querySelector('.ant-select-content');
|
|
305
|
-
expect(selector).toBeTruthy();
|
|
306
|
-
yield user.click(selector);
|
|
307
|
-
yield waitFor(() => {
|
|
308
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
309
|
-
});
|
|
310
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
311
|
-
if (selectAllCheckbox) {
|
|
312
|
-
var checkbox = selectAllCheckbox.querySelector('.ant-checkbox');
|
|
313
|
-
expect(checkbox).toBeInTheDocument();
|
|
314
|
-
expect(checkbox).toHaveClass('ant-checkbox-indeterminate');
|
|
315
|
-
}
|
|
316
|
-
}));
|
|
317
|
-
it('should show checked state when all items are selected', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
318
|
-
var user = userEvent.setup();
|
|
319
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
320
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
321
|
-
options: options,
|
|
322
|
-
value: ['1', '2', '3'],
|
|
323
|
-
customPopupRender: true,
|
|
324
|
-
staticValue: true
|
|
325
|
-
}));
|
|
326
|
-
var selector = document.querySelector('.ant-select-content');
|
|
327
|
-
expect(selector).toBeTruthy();
|
|
328
|
-
yield user.click(selector);
|
|
329
|
-
yield waitFor(() => {
|
|
330
|
-
expect(screen.getByText('Select all')).toBeInTheDocument();
|
|
331
|
-
});
|
|
332
|
-
var selectAllCheckbox = screen.getByText('Select all').closest('.ant-checkbox-wrapper');
|
|
333
|
-
if (selectAllCheckbox) {
|
|
334
|
-
var checkbox = selectAllCheckbox.querySelector('.ant-checkbox');
|
|
335
|
-
expect(checkbox).toBeInTheDocument();
|
|
336
|
-
expect(checkbox).toHaveClass('ant-checkbox-checked');
|
|
337
|
-
}
|
|
338
|
-
}));
|
|
339
|
-
it('should not show select all checkbox when staticValue is false', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
340
|
-
var user = userEvent.setup();
|
|
341
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
342
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
343
|
-
options: options,
|
|
344
|
-
customPopupRender: true,
|
|
345
|
-
staticValue: false
|
|
346
|
-
}));
|
|
347
|
-
var selector = document.querySelector('.ant-select-content');
|
|
348
|
-
expect(selector).toBeTruthy();
|
|
349
|
-
yield user.click(selector);
|
|
350
|
-
yield waitFor(() => {
|
|
351
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
352
|
-
});
|
|
353
|
-
expect(screen.queryByText('Select all')).not.toBeInTheDocument();
|
|
354
|
-
}));
|
|
355
|
-
it('should handle select all with empty options array', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
356
|
-
var handleChange = jest.fn();
|
|
357
|
-
var user = userEvent.setup();
|
|
358
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
359
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
360
|
-
options: [],
|
|
361
|
-
onChange: handleChange,
|
|
362
|
-
customPopupRender: true,
|
|
363
|
-
staticValue: true
|
|
364
|
-
}));
|
|
365
|
-
var selector = document.querySelector('.ant-select-content');
|
|
366
|
-
expect(selector).toBeTruthy();
|
|
367
|
-
yield user.click(selector);
|
|
368
|
-
expect(screen.queryByText('Select all')).not.toBeInTheDocument();
|
|
369
|
-
}));
|
|
370
|
-
});
|
|
371
|
-
describe('Search Functionality', () => {
|
|
372
|
-
it('should filter options based on search input', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
373
|
-
var user = userEvent.setup();
|
|
374
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
375
|
-
options: options,
|
|
376
|
-
showSearch: true,
|
|
377
|
-
customPopupRender: true
|
|
378
|
-
}));
|
|
379
|
-
var selector = document.querySelector('.ant-select-content');
|
|
380
|
-
expect(selector).toBeTruthy();
|
|
381
|
-
yield user.click(selector);
|
|
382
|
-
yield waitFor(() => {
|
|
383
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
384
|
-
expect(searchInput).toBeInTheDocument();
|
|
385
|
-
});
|
|
386
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
387
|
-
expect(searchInput).toBeTruthy();
|
|
388
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
389
|
-
yield user.type(searchInput, 'Option 1');
|
|
390
|
-
}));
|
|
391
|
-
yield waitFor(() => {
|
|
392
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
393
|
-
});
|
|
394
|
-
}));
|
|
395
|
-
});
|
|
396
|
-
describe('Async Search Functionality', () => {
|
|
397
|
-
beforeEach(() => {
|
|
398
|
-
jest.useFakeTimers();
|
|
399
|
-
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
400
|
-
});
|
|
401
|
-
afterEach(() => {
|
|
402
|
-
jest.runOnlyPendingTimers();
|
|
403
|
-
jest.useRealTimers();
|
|
404
|
-
jest.restoreAllMocks();
|
|
405
|
-
});
|
|
406
|
-
it('should not call onSearch when onSearch prop is not provided', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
407
|
-
var user = userEvent.setup({
|
|
408
|
-
delay: null
|
|
409
|
-
});
|
|
410
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
411
|
-
options: options,
|
|
412
|
-
showSearch: true,
|
|
413
|
-
customPopupRender: true,
|
|
414
|
-
searchDebounce: 300
|
|
415
|
-
}));
|
|
416
|
-
var selector = document.querySelector('.ant-select-content');
|
|
417
|
-
expect(selector).toBeTruthy();
|
|
418
|
-
yield user.click(selector);
|
|
419
|
-
yield waitFor(() => {
|
|
420
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
421
|
-
expect(searchInput).toBeInTheDocument();
|
|
422
|
-
});
|
|
423
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
424
|
-
expect(searchInput).toBeTruthy();
|
|
425
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
426
|
-
yield user.type(searchInput, 'test');
|
|
427
|
-
}));
|
|
428
|
-
jest.advanceTimersByTime(300);
|
|
429
|
-
yield waitFor(() => {
|
|
430
|
-
expect(screen.queryByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
431
|
-
});
|
|
432
|
-
}));
|
|
433
|
-
it('should reset async options when query is empty', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
434
|
-
var mockOnSearch = jest.fn().mockResolvedValue([]);
|
|
435
|
-
var user = userEvent.setup({
|
|
436
|
-
delay: null
|
|
437
|
-
});
|
|
438
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
439
|
-
options: options,
|
|
440
|
-
showSearch: true,
|
|
441
|
-
customPopupRender: true,
|
|
442
|
-
onSearch: mockOnSearch,
|
|
443
|
-
searchDebounce: 300,
|
|
444
|
-
staticValue: false
|
|
445
|
-
}));
|
|
446
|
-
var selector = document.querySelector('.ant-select-content');
|
|
447
|
-
expect(selector).toBeTruthy();
|
|
448
|
-
yield user.click(selector);
|
|
449
|
-
yield waitFor(() => {
|
|
450
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
451
|
-
expect(searchInput).toBeInTheDocument();
|
|
452
|
-
});
|
|
453
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
454
|
-
expect(searchInput).toBeTruthy();
|
|
455
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
456
|
-
yield user.type(searchInput, 'test');
|
|
457
|
-
}));
|
|
458
|
-
jest.advanceTimersByTime(300);
|
|
459
|
-
yield waitFor(() => {
|
|
460
|
-
expect(mockOnSearch).toHaveBeenCalledWith('test');
|
|
461
|
-
});
|
|
462
|
-
yield user.clear(searchInput);
|
|
463
|
-
jest.advanceTimersByTime(300);
|
|
464
|
-
yield waitFor(() => {
|
|
465
|
-
expect(mockOnSearch).toHaveBeenCalledTimes(2);
|
|
466
|
-
expect(mockOnSearch).toHaveBeenLastCalledWith('');
|
|
467
|
-
});
|
|
468
|
-
}));
|
|
469
|
-
it('should handle successful async search and cache results', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
470
|
-
var asyncResults = mockAsyncResults;
|
|
471
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
472
|
-
var user = userEvent.setup({
|
|
473
|
-
delay: null
|
|
474
|
-
});
|
|
475
|
-
var {
|
|
476
|
-
rerender
|
|
477
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
478
|
-
options: options,
|
|
479
|
-
showSearch: true,
|
|
480
|
-
customPopupRender: true,
|
|
481
|
-
onSearch: mockOnSearch,
|
|
482
|
-
searchDebounce: 300,
|
|
483
|
-
staticValue: false
|
|
484
|
-
}));
|
|
485
|
-
var selector = document.querySelector('.ant-select-content');
|
|
486
|
-
expect(selector).toBeTruthy();
|
|
487
|
-
yield user.click(selector);
|
|
488
|
-
yield waitFor(() => {
|
|
489
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
490
|
-
expect(searchInput).toBeInTheDocument();
|
|
491
|
-
});
|
|
492
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
493
|
-
expect(searchInput).toBeTruthy();
|
|
494
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
495
|
-
yield user.type(searchInput, 'async');
|
|
496
|
-
}));
|
|
497
|
-
jest.advanceTimersByTime(300);
|
|
498
|
-
yield waitFor(() => {
|
|
499
|
-
expect(mockOnSearch).toHaveBeenCalledWith('async');
|
|
500
|
-
});
|
|
501
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
502
|
-
options: asyncResults,
|
|
503
|
-
showSearch: true,
|
|
504
|
-
customPopupRender: true,
|
|
505
|
-
onSearch: mockOnSearch,
|
|
506
|
-
searchDebounce: 300,
|
|
507
|
-
staticValue: false
|
|
508
|
-
}));
|
|
509
|
-
yield waitFor(() => {
|
|
510
|
-
expect(screen.getByText('Async Option 1')).toBeInTheDocument();
|
|
511
|
-
expect(screen.getByText('Async Option 2')).toBeInTheDocument();
|
|
512
|
-
});
|
|
513
|
-
}));
|
|
514
|
-
it('should handle async search error gracefully', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
515
|
-
var mockOnSearch = jest.fn().mockImplementation(() => {
|
|
516
|
-
return Promise.reject(new Error('API Error')).catch(() => {});
|
|
517
|
-
});
|
|
518
|
-
var user = userEvent.setup({
|
|
519
|
-
delay: null
|
|
520
|
-
});
|
|
521
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
522
|
-
options: [],
|
|
523
|
-
showSearch: true,
|
|
524
|
-
customPopupRender: true,
|
|
525
|
-
onSearch: mockOnSearch,
|
|
526
|
-
searchDebounce: 300,
|
|
527
|
-
staticValue: false
|
|
528
|
-
}));
|
|
529
|
-
var selector = document.querySelector('.ant-select-content');
|
|
530
|
-
expect(selector).toBeTruthy();
|
|
531
|
-
yield user.click(selector);
|
|
532
|
-
yield waitFor(() => {
|
|
533
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
534
|
-
expect(searchInput).toBeInTheDocument();
|
|
535
|
-
});
|
|
536
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
537
|
-
expect(searchInput).toBeTruthy();
|
|
538
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
539
|
-
yield user.type(searchInput, 'test');
|
|
540
|
-
}));
|
|
541
|
-
jest.advanceTimersByTime(300);
|
|
542
|
-
yield waitFor(() => {
|
|
543
|
-
expect(mockOnSearch).toHaveBeenCalledWith('test');
|
|
544
|
-
}, {
|
|
545
|
-
timeout: 1000
|
|
546
|
-
});
|
|
547
|
-
yield Promise.resolve();
|
|
548
|
-
yield waitFor(() => {
|
|
549
|
-
expect(screen.getByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
550
|
-
}, {
|
|
551
|
-
timeout: 1000
|
|
552
|
-
});
|
|
553
|
-
}));
|
|
554
|
-
it('should debounce async search calls', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
555
|
-
var mockOnSearch = jest.fn().mockResolvedValue([]);
|
|
556
|
-
var user = userEvent.setup({
|
|
557
|
-
delay: null
|
|
558
|
-
});
|
|
559
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
560
|
-
options: options,
|
|
561
|
-
showSearch: true,
|
|
562
|
-
customPopupRender: true,
|
|
563
|
-
onSearch: mockOnSearch,
|
|
564
|
-
searchDebounce: 300,
|
|
565
|
-
staticValue: false
|
|
566
|
-
}));
|
|
567
|
-
var selector = document.querySelector('.ant-select-content');
|
|
568
|
-
expect(selector).toBeTruthy();
|
|
569
|
-
yield user.click(selector);
|
|
570
|
-
yield waitFor(() => {
|
|
571
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
572
|
-
expect(searchInput).toBeInTheDocument();
|
|
573
|
-
});
|
|
574
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
575
|
-
expect(searchInput).toBeTruthy();
|
|
576
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
577
|
-
yield user.type(searchInput, 't');
|
|
578
|
-
}));
|
|
579
|
-
jest.advanceTimersByTime(100);
|
|
580
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
581
|
-
yield user.type(searchInput, 'e');
|
|
582
|
-
}));
|
|
583
|
-
jest.advanceTimersByTime(100);
|
|
584
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
585
|
-
yield user.type(searchInput, 's');
|
|
586
|
-
}));
|
|
587
|
-
jest.advanceTimersByTime(100);
|
|
588
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
589
|
-
yield user.type(searchInput, 't');
|
|
590
|
-
}));
|
|
591
|
-
expect(mockOnSearch).not.toHaveBeenCalled();
|
|
592
|
-
jest.advanceTimersByTime(300);
|
|
593
|
-
yield waitFor(() => {
|
|
594
|
-
expect(mockOnSearch).toHaveBeenCalledTimes(1);
|
|
595
|
-
expect(mockOnSearch).toHaveBeenCalledWith('test');
|
|
596
|
-
});
|
|
597
|
-
}));
|
|
598
|
-
it('should clear previous timeout when new search is triggered', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
599
|
-
var mockOnSearch = jest.fn().mockResolvedValue([]);
|
|
600
|
-
var user = userEvent.setup({
|
|
601
|
-
delay: null
|
|
602
|
-
});
|
|
603
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
604
|
-
options: options,
|
|
605
|
-
showSearch: true,
|
|
606
|
-
customPopupRender: true,
|
|
607
|
-
onSearch: mockOnSearch,
|
|
608
|
-
searchDebounce: 300,
|
|
609
|
-
staticValue: false
|
|
610
|
-
}));
|
|
611
|
-
var selector = document.querySelector('.ant-select-content');
|
|
612
|
-
expect(selector).toBeTruthy();
|
|
613
|
-
yield user.click(selector);
|
|
614
|
-
yield waitFor(() => {
|
|
615
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
616
|
-
expect(searchInput).toBeInTheDocument();
|
|
617
|
-
});
|
|
618
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
619
|
-
expect(searchInput).toBeTruthy();
|
|
620
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
621
|
-
yield user.type(searchInput, 'first');
|
|
622
|
-
}));
|
|
623
|
-
jest.advanceTimersByTime(200);
|
|
624
|
-
yield user.clear(searchInput);
|
|
625
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
626
|
-
yield user.type(searchInput, 'second');
|
|
627
|
-
}));
|
|
628
|
-
jest.advanceTimersByTime(300);
|
|
629
|
-
yield waitFor(() => {
|
|
630
|
-
expect(mockOnSearch).toHaveBeenCalledTimes(1);
|
|
631
|
-
expect(mockOnSearch).toHaveBeenCalledWith('second');
|
|
632
|
-
expect(mockOnSearch).not.toHaveBeenCalledWith('first');
|
|
633
|
-
});
|
|
634
|
-
}));
|
|
635
|
-
it('should show loading state during async search', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
636
|
-
var mockOnSearch = jest.fn(() => new Promise(resolve => setTimeout(() => resolve([]), 100)));
|
|
637
|
-
var user = userEvent.setup({
|
|
638
|
-
delay: null
|
|
639
|
-
});
|
|
640
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
641
|
-
options: options,
|
|
642
|
-
showSearch: true,
|
|
643
|
-
customPopupRender: true,
|
|
644
|
-
onSearch: mockOnSearch,
|
|
645
|
-
searchDebounce: 300
|
|
646
|
-
}));
|
|
647
|
-
var selector = document.querySelector('.ant-select-content');
|
|
648
|
-
expect(selector).toBeTruthy();
|
|
649
|
-
yield user.click(selector);
|
|
650
|
-
yield waitFor(() => {
|
|
651
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
652
|
-
expect(searchInput).toBeInTheDocument();
|
|
653
|
-
});
|
|
654
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
655
|
-
expect(searchInput).toBeTruthy();
|
|
656
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
657
|
-
yield user.type(searchInput, 'test');
|
|
658
|
-
}));
|
|
659
|
-
jest.advanceTimersByTime(300);
|
|
660
|
-
yield waitFor(() => {
|
|
661
|
-
var searchContainer = document.querySelector('.cap-unified-select-search-container');
|
|
662
|
-
expect(searchContainer).toBeInTheDocument();
|
|
663
|
-
var iconWrapper = searchContainer == null ? void 0 : searchContainer.querySelector('.cap-icon-wrapper');
|
|
664
|
-
expect(iconWrapper).toBeInTheDocument();
|
|
665
|
-
});
|
|
666
|
-
jest.advanceTimersByTime(100);
|
|
667
|
-
yield waitFor(() => {
|
|
668
|
-
var searchContainer = document.querySelector('.cap-unified-select-search-container');
|
|
669
|
-
var iconWrapper = searchContainer == null ? void 0 : searchContainer.querySelector('.cap-icon-wrapper');
|
|
670
|
-
expect(iconWrapper).toBeInTheDocument();
|
|
671
|
-
});
|
|
672
|
-
}));
|
|
673
|
-
it('should cache async search results for selected items', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
674
|
-
var asyncResults = mockAsyncResultsForCache;
|
|
675
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
676
|
-
var user = userEvent.setup({
|
|
677
|
-
delay: null
|
|
678
|
-
});
|
|
679
|
-
var {
|
|
680
|
-
rerender
|
|
681
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
682
|
-
options: options,
|
|
683
|
-
showSearch: true,
|
|
684
|
-
customPopupRender: true,
|
|
685
|
-
onSearch: mockOnSearch,
|
|
686
|
-
searchDebounce: 300,
|
|
687
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
688
|
-
staticValue: false
|
|
689
|
-
}));
|
|
690
|
-
var selector = document.querySelector('.ant-select-content');
|
|
691
|
-
expect(selector).toBeTruthy();
|
|
692
|
-
yield user.click(selector);
|
|
693
|
-
yield waitFor(() => {
|
|
694
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
695
|
-
expect(searchInput).toBeInTheDocument();
|
|
696
|
-
});
|
|
697
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
698
|
-
expect(searchInput).toBeTruthy();
|
|
699
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
700
|
-
yield user.type(searchInput, 'cached');
|
|
701
|
-
}));
|
|
702
|
-
jest.advanceTimersByTime(300);
|
|
703
|
-
yield waitFor(() => {
|
|
704
|
-
expect(mockOnSearch).toHaveBeenCalledWith('cached');
|
|
705
|
-
});
|
|
706
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
707
|
-
options: asyncResults,
|
|
708
|
-
showSearch: true,
|
|
709
|
-
customPopupRender: true,
|
|
710
|
-
onSearch: mockOnSearch,
|
|
711
|
-
searchDebounce: 300,
|
|
712
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
713
|
-
staticValue: false
|
|
714
|
-
}));
|
|
715
|
-
yield waitFor(() => {
|
|
716
|
-
expect(screen.getByText('Cached Option')).toBeInTheDocument();
|
|
717
|
-
});
|
|
718
|
-
yield user.click(screen.getByText('Cached Option'));
|
|
719
|
-
yield user.clear(searchInput);
|
|
720
|
-
jest.advanceTimersByTime(300);
|
|
721
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
722
|
-
options: asyncResults,
|
|
723
|
-
showSearch: true,
|
|
724
|
-
customPopupRender: true,
|
|
725
|
-
onSearch: mockOnSearch,
|
|
726
|
-
searchDebounce: 300,
|
|
727
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
728
|
-
staticValue: false
|
|
729
|
-
}));
|
|
730
|
-
yield waitFor(() => {
|
|
731
|
-
var cachedOptions = screen.getAllByText('Cached Option');
|
|
732
|
-
expect(cachedOptions.length).toBeGreaterThan(0);
|
|
733
|
-
var dropdownOption = cachedOptions.find(option => option.closest('.ant-select-tree-list') || option.closest('.ant-select-dropdown'));
|
|
734
|
-
expect(dropdownOption).toBeInTheDocument();
|
|
735
|
-
});
|
|
736
|
-
}));
|
|
737
|
-
it('should handle empty query with whitespace', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
738
|
-
var mockOnSearch = jest.fn().mockResolvedValue([]);
|
|
739
|
-
var user = userEvent.setup({
|
|
740
|
-
delay: null
|
|
741
|
-
});
|
|
742
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
743
|
-
options: options,
|
|
744
|
-
showSearch: true,
|
|
745
|
-
customPopupRender: true,
|
|
746
|
-
onSearch: mockOnSearch,
|
|
747
|
-
searchDebounce: 300
|
|
748
|
-
}));
|
|
749
|
-
var selector = document.querySelector('.ant-select-content');
|
|
750
|
-
expect(selector).toBeTruthy();
|
|
751
|
-
yield user.click(selector);
|
|
752
|
-
yield waitFor(() => {
|
|
753
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
754
|
-
expect(searchInput).toBeInTheDocument();
|
|
755
|
-
});
|
|
756
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
757
|
-
expect(searchInput).toBeTruthy();
|
|
758
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
759
|
-
yield user.type(searchInput, ' ');
|
|
760
|
-
}));
|
|
761
|
-
jest.advanceTimersByTime(300);
|
|
762
|
-
expect(mockOnSearch).not.toHaveBeenCalled();
|
|
763
|
-
}));
|
|
764
|
-
});
|
|
765
|
-
describe('Tree Select', () => {
|
|
766
|
-
it('should expand parent and select child node', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
767
|
-
var handleChange = jest.fn();
|
|
768
|
-
var user = userEvent.setup();
|
|
769
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
770
|
-
options: treeOptions,
|
|
771
|
-
type: SELECT_TYPES.TREE_SELECT,
|
|
772
|
-
onChange: handleChange,
|
|
773
|
-
customPopupRender: false
|
|
774
|
-
}));
|
|
775
|
-
var selector = document.querySelector('.ant-select-content');
|
|
776
|
-
expect(selector).toBeTruthy();
|
|
777
|
-
yield user.click(selector);
|
|
778
|
-
yield waitFor(() => {
|
|
779
|
-
expect(screen.getByText('Parent 1')).toBeInTheDocument();
|
|
780
|
-
});
|
|
781
|
-
var switcher = document.querySelector('.ant-select-tree-switcher');
|
|
782
|
-
if (switcher) {
|
|
783
|
-
yield user.click(switcher);
|
|
784
|
-
yield waitFor(() => {
|
|
785
|
-
expect(screen.getByText('Child 1')).toBeInTheDocument();
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
}));
|
|
789
|
-
it('should display selected tree value', () => {
|
|
790
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
791
|
-
options: treeOptions,
|
|
792
|
-
type: SELECT_TYPES.TREE_SELECT,
|
|
793
|
-
value: "child1"
|
|
794
|
-
}));
|
|
795
|
-
expect(screen.getByText('Child 1')).toBeInTheDocument();
|
|
796
|
-
});
|
|
797
|
-
});
|
|
798
|
-
describe('Error State', () => {
|
|
799
|
-
it('should display error message when isError is true', () => {
|
|
800
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
801
|
-
options: options,
|
|
802
|
-
isError: true,
|
|
803
|
-
errorMessage: "This field is required"
|
|
804
|
-
}));
|
|
805
|
-
expect(screen.getByText('This field is required')).toBeInTheDocument();
|
|
806
|
-
});
|
|
807
|
-
it('should apply error styling to select', () => {
|
|
808
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
809
|
-
options: options,
|
|
810
|
-
isError: true,
|
|
811
|
-
errorMessage: "Error"
|
|
812
|
-
}));
|
|
813
|
-
var errorElement = screen.getByText('Error');
|
|
814
|
-
expect(errorElement).toHaveClass('cap-unified-select-status');
|
|
815
|
-
});
|
|
816
|
-
});
|
|
817
|
-
describe('Disabled State', () => {
|
|
818
|
-
it('should not call onChange when disabled', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
819
|
-
var handleChange = jest.fn();
|
|
820
|
-
var user = userEvent.setup();
|
|
821
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
822
|
-
options: options,
|
|
823
|
-
disabled: true,
|
|
824
|
-
onChange: handleChange
|
|
825
|
-
}));
|
|
826
|
-
var selector = document.querySelector('.ant-select-content');
|
|
827
|
-
expect(selector).toBeTruthy();
|
|
828
|
-
yield user.click(selector);
|
|
829
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
830
|
-
}));
|
|
831
|
-
it('should not open dropdown when disabled', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
832
|
-
var user = userEvent.setup();
|
|
833
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
834
|
-
options: options,
|
|
835
|
-
disabled: true
|
|
836
|
-
}));
|
|
837
|
-
var selector = document.querySelector('.ant-select-content');
|
|
838
|
-
expect(selector).toBeTruthy();
|
|
839
|
-
yield user.click(selector);
|
|
840
|
-
expect(screen.queryByText('Option 1')).not.toBeInTheDocument();
|
|
841
|
-
}));
|
|
842
|
-
it('should have disabled styling', () => {
|
|
843
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
844
|
-
options: options,
|
|
845
|
-
disabled: true
|
|
846
|
-
}));
|
|
847
|
-
var select = document.querySelector('.ant-select-disabled');
|
|
848
|
-
expect(select).toBeInTheDocument();
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
|
-
describe('Additional Features', () => {
|
|
852
|
-
it('should show clear button when allowClear is enabled with value', () => {
|
|
853
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
854
|
-
options: options,
|
|
855
|
-
allowClear: true,
|
|
856
|
-
value: "1"
|
|
857
|
-
}));
|
|
858
|
-
var clearIcon = document.querySelector('.ant-select-clear');
|
|
859
|
-
expect(clearIcon).toBeInTheDocument();
|
|
860
|
-
});
|
|
861
|
-
it('should clear value when clear button is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
862
|
-
var handleChange = jest.fn();
|
|
863
|
-
var user = userEvent.setup();
|
|
864
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
865
|
-
options: options,
|
|
866
|
-
allowClear: true,
|
|
867
|
-
value: "1",
|
|
868
|
-
onChange: handleChange
|
|
869
|
-
}));
|
|
870
|
-
var clearIcon = document.querySelector('.ant-select-clear');
|
|
871
|
-
if (clearIcon) {
|
|
872
|
-
yield user.click(clearIcon);
|
|
873
|
-
expect(handleChange).toHaveBeenCalled();
|
|
874
|
-
expect(handleChange.mock.calls[0][0]).toBeUndefined();
|
|
875
|
-
}
|
|
876
|
-
}));
|
|
877
|
-
it('should render empty state when no options', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
878
|
-
var user = userEvent.setup();
|
|
879
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
880
|
-
options: [],
|
|
881
|
-
customPopupRender: true
|
|
882
|
-
}));
|
|
883
|
-
var selector = document.querySelector('.ant-select-content');
|
|
884
|
-
expect(selector).toBeTruthy();
|
|
885
|
-
yield user.click(selector);
|
|
886
|
-
yield waitFor(() => {
|
|
887
|
-
expect(screen.getByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
888
|
-
});
|
|
889
|
-
}));
|
|
890
|
-
});
|
|
891
|
-
describe('NoResult Component', () => {
|
|
892
|
-
beforeEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
893
|
-
// Ensure any previous dropdowns are closed before starting a new test
|
|
894
|
-
var openDropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
895
|
-
if (openDropdowns.length > 0) {
|
|
896
|
-
// Click outside to close all dropdowns
|
|
897
|
-
var bodyClick = new MouseEvent('mousedown', {
|
|
898
|
-
bubbles: true
|
|
899
|
-
});
|
|
900
|
-
document.body.dispatchEvent(bodyClick);
|
|
901
|
-
// Also try Escape key
|
|
902
|
-
var escapeEvent = new KeyboardEvent('keydown', {
|
|
903
|
-
key: 'Escape',
|
|
904
|
-
bubbles: true
|
|
905
|
-
});
|
|
906
|
-
document.body.dispatchEvent(escapeEvent);
|
|
907
|
-
// Wait for all dropdowns to close
|
|
908
|
-
yield waitFor(() => {
|
|
909
|
-
var stillOpen = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
910
|
-
expect(stillOpen).toBeNull();
|
|
911
|
-
}, {
|
|
912
|
-
timeout: 1000
|
|
913
|
-
}).catch(() => {
|
|
914
|
-
// Ignore if already closed or timeout - continue anyway
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
// Small delay to ensure DOM is clean
|
|
918
|
-
yield new Promise(resolve => setTimeout(resolve, 50));
|
|
919
|
-
}));
|
|
920
|
-
afterEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
921
|
-
// Close any open dropdowns by clicking outside
|
|
922
|
-
var openDropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
923
|
-
if (openDropdowns.length > 0) {
|
|
924
|
-
// Click outside to close all dropdowns
|
|
925
|
-
var bodyClick = new MouseEvent('mousedown', {
|
|
926
|
-
bubbles: true
|
|
927
|
-
});
|
|
928
|
-
document.body.dispatchEvent(bodyClick);
|
|
929
|
-
// Wait for all dropdowns to close
|
|
930
|
-
yield waitFor(() => {
|
|
931
|
-
var stillOpen = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
932
|
-
expect(stillOpen).toBeNull();
|
|
933
|
-
}, {
|
|
934
|
-
timeout: 1000
|
|
935
|
-
}).catch(() => {
|
|
936
|
-
// Ignore if already closed or timeout
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
cleanup();
|
|
940
|
-
// Clear any remaining timers
|
|
941
|
-
jest.clearAllTimers();
|
|
942
|
-
// Small delay to ensure cleanup completes
|
|
943
|
-
yield new Promise(resolve => setTimeout(resolve, 50));
|
|
944
|
-
}));
|
|
945
|
-
it("should display default \"" + DEFAULTS.NO_RESULT_TEXT + "\" text when no options", /*#__PURE__*/_asyncToGenerator(function* () {
|
|
946
|
-
var user = userEvent.setup();
|
|
947
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
948
|
-
options: [],
|
|
949
|
-
customPopupRender: true
|
|
950
|
-
}));
|
|
951
|
-
var selector = document.querySelector('.ant-select-content');
|
|
952
|
-
expect(selector).toBeTruthy();
|
|
953
|
-
yield user.click(selector);
|
|
954
|
-
yield waitFor(() => {
|
|
955
|
-
expect(screen.getByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
956
|
-
});
|
|
957
|
-
var noResultContainer = document.querySelector('.cap-unified-select-no-result');
|
|
958
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
959
|
-
}));
|
|
960
|
-
it('should display custom text when noResultCustomText is provided with showUpload', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
961
|
-
var user = userEvent.setup();
|
|
962
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
963
|
-
options: [],
|
|
964
|
-
customPopupRender: true,
|
|
965
|
-
showUpload: true,
|
|
966
|
-
noResultCustomText: "Custom no results message"
|
|
967
|
-
}));
|
|
968
|
-
var selector = document.querySelector('.ant-select-content');
|
|
969
|
-
expect(selector).toBeTruthy();
|
|
970
|
-
yield user.click(selector);
|
|
971
|
-
yield waitFor(() => {
|
|
972
|
-
expect(screen.getByText('Custom no results message')).toBeInTheDocument();
|
|
973
|
-
});
|
|
974
|
-
}));
|
|
975
|
-
it('should display custom text when noResultCustomText is provided without showUpload', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
976
|
-
var user = userEvent.setup();
|
|
977
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
978
|
-
options: [],
|
|
979
|
-
customPopupRender: true,
|
|
980
|
-
noResultCustomText: "Custom no results message"
|
|
981
|
-
}));
|
|
982
|
-
var selector = document.querySelector('.ant-select-content');
|
|
983
|
-
expect(selector).toBeTruthy();
|
|
984
|
-
yield user.click(selector);
|
|
985
|
-
yield waitFor(() => {
|
|
986
|
-
expect(screen.getByText('Custom no results message')).toBeInTheDocument();
|
|
987
|
-
expect(screen.queryByText(DEFAULTS.NO_RESULT_TEXT)).not.toBeInTheDocument();
|
|
988
|
-
});
|
|
989
|
-
}));
|
|
990
|
-
it('should display custom text when showUpload is true and options is empty', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
991
|
-
var user = userEvent.setup();
|
|
992
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
993
|
-
options: [],
|
|
994
|
-
customPopupRender: true,
|
|
995
|
-
showUpload: true,
|
|
996
|
-
noResultCustomText: "Please upload data"
|
|
997
|
-
}));
|
|
998
|
-
var selector = document.querySelector('.ant-select-content');
|
|
999
|
-
expect(selector).toBeTruthy();
|
|
1000
|
-
yield user.click(selector);
|
|
1001
|
-
yield waitFor(() => {
|
|
1002
|
-
expect(screen.getByText('Please upload data')).toBeInTheDocument();
|
|
1003
|
-
});
|
|
1004
|
-
}));
|
|
1005
|
-
it.skip('should display default text when showUpload is true and options has items but search returns no matches', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1006
|
-
var user = userEvent.setup();
|
|
1007
|
-
var {
|
|
1008
|
-
container
|
|
1009
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1010
|
-
options: options,
|
|
1011
|
-
customPopupRender: true,
|
|
1012
|
-
showUpload: true,
|
|
1013
|
-
noResultCustomText: "Please upload data",
|
|
1014
|
-
showSearch: true
|
|
1015
|
-
}));
|
|
1016
|
-
var selector = container.querySelector('.ant-select-content');
|
|
1017
|
-
expect(selector).toBeTruthy();
|
|
1018
|
-
yield user.click(selector);
|
|
1019
|
-
|
|
1020
|
-
// Wait for dropdown to open and get the active dropdown
|
|
1021
|
-
yield waitFor(() => {
|
|
1022
|
-
var dropdown = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1023
|
-
expect(dropdown).toBeInTheDocument();
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
// Get the currently open dropdown (most recent one)
|
|
1027
|
-
var getActiveDropdown = () => {
|
|
1028
|
-
var dropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1029
|
-
return dropdowns[dropdowns.length - 1];
|
|
1030
|
-
};
|
|
1031
|
-
|
|
1032
|
-
// Wait for search input to appear in the active dropdown
|
|
1033
|
-
yield waitFor(() => {
|
|
1034
|
-
var dropdown = getActiveDropdown();
|
|
1035
|
-
var searchInput = dropdown == null ? void 0 : dropdown.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1036
|
-
expect(searchInput).toBeInTheDocument();
|
|
1037
|
-
});
|
|
1038
|
-
var dropdown = getActiveDropdown();
|
|
1039
|
-
var searchInput = dropdown.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1040
|
-
expect(searchInput).toBeTruthy();
|
|
1041
|
-
|
|
1042
|
-
// Clear the input and wait for it to be cleared
|
|
1043
|
-
yield user.clear(searchInput);
|
|
1044
|
-
yield waitFor(() => {
|
|
1045
|
-
expect(searchInput.value).toBe('');
|
|
1046
|
-
});
|
|
1047
|
-
|
|
1048
|
-
// Type the search term
|
|
1049
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1050
|
-
yield user.type(searchInput, 'NonExistentOption');
|
|
1051
|
-
}));
|
|
1052
|
-
|
|
1053
|
-
// Wait for the search input value to be set
|
|
1054
|
-
yield waitFor(() => {
|
|
1055
|
-
expect(searchInput.value).toBe('NonExistentOption');
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
// Wait for debounce (300ms) + processing time
|
|
1059
|
-
yield new Promise(resolve => setTimeout(resolve, 400));
|
|
1060
|
-
|
|
1061
|
-
// Wait for options to be filtered out and NoResult to appear in the active dropdown
|
|
1062
|
-
yield waitFor(() => {
|
|
1063
|
-
var activeDropdown = getActiveDropdown();
|
|
1064
|
-
// Check that NoResult component appears in the active dropdown
|
|
1065
|
-
var noResultContainer = activeDropdown == null ? void 0 : activeDropdown.querySelector('.cap-unified-select-no-result-text');
|
|
1066
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
1067
|
-
// Verify the text content is correct
|
|
1068
|
-
expect(screen.getByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
1069
|
-
}, {
|
|
1070
|
-
timeout: 3000
|
|
1071
|
-
});
|
|
1072
|
-
|
|
1073
|
-
// Close dropdown to prevent interference with next test
|
|
1074
|
-
yield user.click(document.body);
|
|
1075
|
-
// Wait for dropdown to close
|
|
1076
|
-
yield waitFor(() => {
|
|
1077
|
-
var openDropdown = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1078
|
-
expect(openDropdown).toBeNull();
|
|
1079
|
-
}, {
|
|
1080
|
-
timeout: 1000
|
|
1081
|
-
}).catch(() => {
|
|
1082
|
-
// Ignore if already closed
|
|
1083
|
-
});
|
|
1084
|
-
}));
|
|
1085
|
-
it('should display custom icon when noResultCustomIcon is provided', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1086
|
-
var user = userEvent.setup();
|
|
1087
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1088
|
-
options: [],
|
|
1089
|
-
customPopupRender: true,
|
|
1090
|
-
noResultCustomIcon: "info"
|
|
1091
|
-
}));
|
|
1092
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1093
|
-
expect(selector).toBeTruthy();
|
|
1094
|
-
yield user.click(selector);
|
|
1095
|
-
yield waitFor(() => {
|
|
1096
|
-
var noResultContainer = document.querySelector('.cap-unified-select-no-result');
|
|
1097
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
1098
|
-
var iconWrapper = noResultContainer == null ? void 0 : noResultContainer.querySelector('.cap-icon-wrapper');
|
|
1099
|
-
expect(iconWrapper).toBeInTheDocument();
|
|
1100
|
-
});
|
|
1101
|
-
}));
|
|
1102
|
-
it('should display default warning icon when noResultCustomIcon is not provided', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1103
|
-
var user = userEvent.setup();
|
|
1104
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1105
|
-
options: [],
|
|
1106
|
-
customPopupRender: true
|
|
1107
|
-
}));
|
|
1108
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1109
|
-
expect(selector).toBeTruthy();
|
|
1110
|
-
yield user.click(selector);
|
|
1111
|
-
yield waitFor(() => {
|
|
1112
|
-
var noResultContainer = document.querySelector('.cap-unified-select-no-result');
|
|
1113
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
1114
|
-
var iconWrapper = noResultContainer == null ? void 0 : noResultContainer.querySelector('.cap-icon-wrapper');
|
|
1115
|
-
expect(iconWrapper).toBeInTheDocument();
|
|
1116
|
-
});
|
|
1117
|
-
}));
|
|
1118
|
-
it('should apply custom className to NoResult component', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1119
|
-
var user = userEvent.setup();
|
|
1120
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1121
|
-
options: [],
|
|
1122
|
-
customPopupRender: true,
|
|
1123
|
-
className: "custom-no-result-class"
|
|
1124
|
-
}));
|
|
1125
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1126
|
-
expect(selector).toBeTruthy();
|
|
1127
|
-
yield user.click(selector);
|
|
1128
|
-
yield waitFor(() => {
|
|
1129
|
-
var noResultContainer = document.querySelector('.cap-unified-select-no-result');
|
|
1130
|
-
expect(noResultContainer).toHaveClass('custom-no-result-class');
|
|
1131
|
-
});
|
|
1132
|
-
}));
|
|
1133
|
-
it.skip('should show NoResult when search returns no matches', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1134
|
-
var user = userEvent.setup();
|
|
1135
|
-
var {
|
|
1136
|
-
container
|
|
1137
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1138
|
-
options: options,
|
|
1139
|
-
customPopupRender: true,
|
|
1140
|
-
showSearch: true
|
|
1141
|
-
}));
|
|
1142
|
-
var selector = container.querySelector('.ant-select-content');
|
|
1143
|
-
expect(selector).toBeTruthy();
|
|
1144
|
-
yield user.click(selector);
|
|
1145
|
-
|
|
1146
|
-
// Wait for dropdown to open and get the active dropdown
|
|
1147
|
-
yield waitFor(() => {
|
|
1148
|
-
var dropdown = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1149
|
-
expect(dropdown).toBeInTheDocument();
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
// Get the currently open dropdown (most recent one)
|
|
1153
|
-
var getActiveDropdown = () => {
|
|
1154
|
-
var dropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1155
|
-
return dropdowns[dropdowns.length - 1];
|
|
1156
|
-
};
|
|
1157
|
-
|
|
1158
|
-
// Wait for search input to appear in the active dropdown
|
|
1159
|
-
yield waitFor(() => {
|
|
1160
|
-
var dropdown = getActiveDropdown();
|
|
1161
|
-
var searchInput = dropdown == null ? void 0 : dropdown.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1162
|
-
expect(searchInput).toBeInTheDocument();
|
|
1163
|
-
});
|
|
1164
|
-
var dropdown = getActiveDropdown();
|
|
1165
|
-
var searchInput = dropdown.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1166
|
-
expect(searchInput).toBeTruthy();
|
|
1167
|
-
|
|
1168
|
-
// Clear the input and wait for it to be cleared
|
|
1169
|
-
yield user.clear(searchInput);
|
|
1170
|
-
yield waitFor(() => {
|
|
1171
|
-
expect(searchInput.value).toBe('');
|
|
1172
|
-
});
|
|
1173
|
-
|
|
1174
|
-
// Type the search term
|
|
1175
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1176
|
-
yield user.type(searchInput, 'NonExistentSearchTerm');
|
|
1177
|
-
}));
|
|
1178
|
-
|
|
1179
|
-
// Wait for the search input value to be set
|
|
1180
|
-
yield waitFor(() => {
|
|
1181
|
-
expect(searchInput.value).toBe('NonExistentSearchTerm');
|
|
1182
|
-
});
|
|
1183
|
-
|
|
1184
|
-
// Wait for debounce (300ms) + processing time
|
|
1185
|
-
yield new Promise(resolve => setTimeout(resolve, 400));
|
|
1186
|
-
|
|
1187
|
-
// Wait for options to be filtered out and NoResult to appear in the active dropdown
|
|
1188
|
-
yield waitFor(() => {
|
|
1189
|
-
var activeDropdown = getActiveDropdown();
|
|
1190
|
-
// Check that NoResult component appears in the active dropdown
|
|
1191
|
-
var noResultContainer = activeDropdown == null ? void 0 : activeDropdown.querySelector('.cap-unified-select-no-result-text');
|
|
1192
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
1193
|
-
// Verify the text content is correct
|
|
1194
|
-
expect(screen.getByText(DEFAULTS.NO_RESULT_TEXT)).toBeInTheDocument();
|
|
1195
|
-
}, {
|
|
1196
|
-
timeout: 3000
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
|
-
// Close dropdown to prevent interference with next test
|
|
1200
|
-
yield user.click(document.body);
|
|
1201
|
-
// Wait for dropdown to close
|
|
1202
|
-
yield waitFor(() => {
|
|
1203
|
-
var openDropdown = document.querySelector('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
|
|
1204
|
-
expect(openDropdown).toBeNull();
|
|
1205
|
-
}, {
|
|
1206
|
-
timeout: 1000
|
|
1207
|
-
}).catch(() => {
|
|
1208
|
-
// Ignore if already closed
|
|
1209
|
-
});
|
|
1210
|
-
}));
|
|
1211
|
-
it('should show NoResult with custom text and icon together', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1212
|
-
var user = userEvent.setup();
|
|
1213
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1214
|
-
options: [],
|
|
1215
|
-
customPopupRender: true,
|
|
1216
|
-
showUpload: true,
|
|
1217
|
-
noResultCustomText: "Upload your data to get started",
|
|
1218
|
-
noResultCustomIcon: "upload"
|
|
1219
|
-
}));
|
|
1220
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1221
|
-
expect(selector).toBeTruthy();
|
|
1222
|
-
yield user.click(selector);
|
|
1223
|
-
yield waitFor(() => {
|
|
1224
|
-
expect(screen.getByText('Upload your data to get started')).toBeInTheDocument();
|
|
1225
|
-
var noResultContainer = document.querySelector('.cap-unified-select-no-result');
|
|
1226
|
-
expect(noResultContainer).toBeInTheDocument();
|
|
1227
|
-
var iconWrapper = noResultContainer == null ? void 0 : noResultContainer.querySelector('.cap-icon-wrapper');
|
|
1228
|
-
expect(iconWrapper).toBeInTheDocument();
|
|
1229
|
-
});
|
|
1230
|
-
}));
|
|
1231
|
-
});
|
|
1232
|
-
describe('Confirm Button and resetSearch', () => {
|
|
1233
|
-
beforeEach(() => {
|
|
1234
|
-
jest.useFakeTimers();
|
|
1235
|
-
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
1236
|
-
});
|
|
1237
|
-
afterEach(() => {
|
|
1238
|
-
jest.runOnlyPendingTimers();
|
|
1239
|
-
jest.useRealTimers();
|
|
1240
|
-
jest.restoreAllMocks();
|
|
1241
|
-
});
|
|
1242
|
-
it('should call onChange and onConfirm when confirm button is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1243
|
-
var handleChange = jest.fn();
|
|
1244
|
-
var handleConfirm = jest.fn();
|
|
1245
|
-
var user = userEvent.setup({
|
|
1246
|
-
delay: null
|
|
1247
|
-
});
|
|
1248
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1249
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1250
|
-
options: options,
|
|
1251
|
-
onChange: handleChange,
|
|
1252
|
-
onConfirm: handleConfirm,
|
|
1253
|
-
customPopupRender: true
|
|
1254
|
-
}));
|
|
1255
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1256
|
-
expect(selector).toBeTruthy();
|
|
1257
|
-
yield user.click(selector);
|
|
1258
|
-
yield waitFor(() => {
|
|
1259
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1260
|
-
});
|
|
1261
|
-
yield user.click(screen.getByText('Option 1'));
|
|
1262
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1263
|
-
yield user.click(confirmButton);
|
|
1264
|
-
expect(handleChange).toHaveBeenCalled();
|
|
1265
|
-
expect(handleConfirm).toHaveBeenCalled();
|
|
1266
|
-
expect(handleChange.mock.calls[0][0]).toEqual(['1']);
|
|
1267
|
-
expect(handleConfirm.mock.calls[0][0]).toEqual(['1']);
|
|
1268
|
-
}));
|
|
1269
|
-
it('should not reset search text when resetSearch is false', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1270
|
-
var asyncResults = mockAsyncResultsForResetSearch;
|
|
1271
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
1272
|
-
var user = userEvent.setup({
|
|
1273
|
-
delay: null
|
|
1274
|
-
});
|
|
1275
|
-
var {
|
|
1276
|
-
rerender
|
|
1277
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1278
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1279
|
-
options: options,
|
|
1280
|
-
showSearch: true,
|
|
1281
|
-
customPopupRender: true,
|
|
1282
|
-
onSearch: mockOnSearch,
|
|
1283
|
-
searchDebounce: 300,
|
|
1284
|
-
resetSearch: false,
|
|
1285
|
-
staticValue: false
|
|
1286
|
-
}));
|
|
1287
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1288
|
-
expect(selector).toBeTruthy();
|
|
1289
|
-
yield user.click(selector);
|
|
1290
|
-
yield waitFor(() => {
|
|
1291
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1292
|
-
expect(searchInput).toBeInTheDocument();
|
|
1293
|
-
});
|
|
1294
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1295
|
-
expect(searchInput).toBeTruthy();
|
|
1296
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1297
|
-
yield user.type(searchInput, 'search');
|
|
1298
|
-
}));
|
|
1299
|
-
jest.advanceTimersByTime(300);
|
|
1300
|
-
yield waitFor(() => {
|
|
1301
|
-
expect(mockOnSearch).toHaveBeenCalledWith('search');
|
|
1302
|
-
});
|
|
1303
|
-
expect(searchInput.value).toBe('search');
|
|
1304
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1305
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1306
|
-
options: asyncResults,
|
|
1307
|
-
showSearch: true,
|
|
1308
|
-
customPopupRender: true,
|
|
1309
|
-
onSearch: mockOnSearch,
|
|
1310
|
-
searchDebounce: 300,
|
|
1311
|
-
resetSearch: false,
|
|
1312
|
-
staticValue: false
|
|
1313
|
-
}));
|
|
1314
|
-
yield waitFor(() => {
|
|
1315
|
-
expect(screen.getByText('Search Result 1')).toBeInTheDocument();
|
|
1316
|
-
});
|
|
1317
|
-
var option = screen.getByText('Search Result 1');
|
|
1318
|
-
yield user.click(option);
|
|
1319
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1320
|
-
yield user.click(confirmButton);
|
|
1321
|
-
yield waitFor(() => {
|
|
1322
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1323
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1324
|
-
}, {
|
|
1325
|
-
timeout: 2000
|
|
1326
|
-
});
|
|
1327
|
-
yield user.click(selector);
|
|
1328
|
-
yield waitFor(() => {
|
|
1329
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1330
|
-
expect(dropdown).not.toHaveClass('ant-select-dropdown-hidden');
|
|
1331
|
-
var searchInputAfter = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1332
|
-
expect(searchInputAfter).toBeInTheDocument();
|
|
1333
|
-
expect(searchInputAfter.value).toBe('search');
|
|
1334
|
-
});
|
|
1335
|
-
}));
|
|
1336
|
-
it('should reset search text by default (resetSearch defaults to true)', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1337
|
-
var asyncResults = mockAsyncResultsForResetSearch;
|
|
1338
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
1339
|
-
var user = userEvent.setup({
|
|
1340
|
-
delay: null
|
|
1341
|
-
});
|
|
1342
|
-
var {
|
|
1343
|
-
rerender
|
|
1344
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1345
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1346
|
-
options: options,
|
|
1347
|
-
showSearch: true,
|
|
1348
|
-
customPopupRender: true,
|
|
1349
|
-
onSearch: mockOnSearch,
|
|
1350
|
-
searchDebounce: 300,
|
|
1351
|
-
staticValue: false
|
|
1352
|
-
}));
|
|
1353
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1354
|
-
expect(selector).toBeTruthy();
|
|
1355
|
-
yield user.click(selector);
|
|
1356
|
-
yield waitFor(() => {
|
|
1357
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1358
|
-
expect(searchInput).toBeInTheDocument();
|
|
1359
|
-
});
|
|
1360
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1361
|
-
expect(searchInput).toBeTruthy();
|
|
1362
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1363
|
-
yield user.type(searchInput, 'search');
|
|
1364
|
-
}));
|
|
1365
|
-
jest.advanceTimersByTime(300);
|
|
1366
|
-
yield waitFor(() => {
|
|
1367
|
-
expect(mockOnSearch).toHaveBeenCalledWith('search');
|
|
1368
|
-
});
|
|
1369
|
-
expect(searchInput.value).toBe('search');
|
|
1370
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1371
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1372
|
-
options: asyncResults,
|
|
1373
|
-
showSearch: true,
|
|
1374
|
-
customPopupRender: true,
|
|
1375
|
-
onSearch: mockOnSearch,
|
|
1376
|
-
searchDebounce: 300,
|
|
1377
|
-
staticValue: false
|
|
1378
|
-
}));
|
|
1379
|
-
yield waitFor(() => {
|
|
1380
|
-
expect(screen.getByText('Search Result 1')).toBeInTheDocument();
|
|
1381
|
-
});
|
|
1382
|
-
yield user.click(screen.getByText('Search Result 1'));
|
|
1383
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1384
|
-
yield user.click(confirmButton);
|
|
1385
|
-
yield user.click(selector);
|
|
1386
|
-
yield waitFor(() => {
|
|
1387
|
-
var searchInputAfterConfirm = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1388
|
-
expect(searchInputAfterConfirm).toBeInTheDocument();
|
|
1389
|
-
expect(searchInputAfterConfirm.value).toBe('');
|
|
1390
|
-
});
|
|
1391
|
-
}));
|
|
1392
|
-
it('should reset search text when resetSearch is explicitly set to true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1393
|
-
var asyncResults = mockAsyncResultsForResetSearch;
|
|
1394
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
1395
|
-
var user = userEvent.setup({
|
|
1396
|
-
delay: null
|
|
1397
|
-
});
|
|
1398
|
-
var {
|
|
1399
|
-
rerender
|
|
1400
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1401
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1402
|
-
options: options,
|
|
1403
|
-
showSearch: true,
|
|
1404
|
-
customPopupRender: true,
|
|
1405
|
-
onSearch: mockOnSearch,
|
|
1406
|
-
searchDebounce: 300,
|
|
1407
|
-
resetSearch: true,
|
|
1408
|
-
staticValue: false
|
|
1409
|
-
}));
|
|
1410
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1411
|
-
expect(selector).toBeTruthy();
|
|
1412
|
-
yield user.click(selector);
|
|
1413
|
-
yield waitFor(() => {
|
|
1414
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1415
|
-
expect(searchInput).toBeInTheDocument();
|
|
1416
|
-
});
|
|
1417
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1418
|
-
expect(searchInput).toBeTruthy();
|
|
1419
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1420
|
-
yield user.type(searchInput, 'search');
|
|
1421
|
-
}));
|
|
1422
|
-
jest.advanceTimersByTime(300);
|
|
1423
|
-
yield waitFor(() => {
|
|
1424
|
-
expect(mockOnSearch).toHaveBeenCalledWith('search');
|
|
1425
|
-
});
|
|
1426
|
-
expect(searchInput.value).toBe('search');
|
|
1427
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1428
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1429
|
-
options: asyncResults,
|
|
1430
|
-
showSearch: true,
|
|
1431
|
-
customPopupRender: true,
|
|
1432
|
-
onSearch: mockOnSearch,
|
|
1433
|
-
searchDebounce: 300,
|
|
1434
|
-
resetSearch: true,
|
|
1435
|
-
staticValue: false
|
|
1436
|
-
}));
|
|
1437
|
-
yield waitFor(() => {
|
|
1438
|
-
expect(screen.getByText('Search Result 1')).toBeInTheDocument();
|
|
1439
|
-
});
|
|
1440
|
-
var option = screen.getByText('Search Result 1');
|
|
1441
|
-
yield user.click(option);
|
|
1442
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1443
|
-
yield user.click(confirmButton);
|
|
1444
|
-
yield waitFor(() => {
|
|
1445
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1446
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1447
|
-
}, {
|
|
1448
|
-
timeout: 2000
|
|
1449
|
-
});
|
|
1450
|
-
yield user.click(selector);
|
|
1451
|
-
yield waitFor(() => {
|
|
1452
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1453
|
-
expect(dropdown).not.toHaveClass('ant-select-dropdown-hidden');
|
|
1454
|
-
var searchInputAfter = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1455
|
-
expect(searchInputAfter).toBeInTheDocument();
|
|
1456
|
-
expect(searchInputAfter.value).toBe('');
|
|
1457
|
-
});
|
|
1458
|
-
}));
|
|
1459
|
-
it('should clear asyncOptions when resetSearch is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1460
|
-
var asyncResults = mockAsyncResults;
|
|
1461
|
-
var mockOnSearch = jest.fn().mockResolvedValue(asyncResults);
|
|
1462
|
-
var user = userEvent.setup({
|
|
1463
|
-
delay: null
|
|
1464
|
-
});
|
|
1465
|
-
var {
|
|
1466
|
-
rerender
|
|
1467
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1468
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1469
|
-
options: options,
|
|
1470
|
-
showSearch: true,
|
|
1471
|
-
customPopupRender: true,
|
|
1472
|
-
onSearch: mockOnSearch,
|
|
1473
|
-
searchDebounce: 300,
|
|
1474
|
-
resetSearch: true,
|
|
1475
|
-
staticValue: false
|
|
1476
|
-
}));
|
|
1477
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1478
|
-
expect(selector).toBeTruthy();
|
|
1479
|
-
yield user.click(selector);
|
|
1480
|
-
yield waitFor(() => {
|
|
1481
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1482
|
-
expect(searchInput).toBeInTheDocument();
|
|
1483
|
-
});
|
|
1484
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1485
|
-
expect(searchInput).toBeTruthy();
|
|
1486
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1487
|
-
yield user.type(searchInput, 'async');
|
|
1488
|
-
}));
|
|
1489
|
-
jest.advanceTimersByTime(300);
|
|
1490
|
-
yield waitFor(() => {
|
|
1491
|
-
expect(mockOnSearch).toHaveBeenCalledWith('async');
|
|
1492
|
-
});
|
|
1493
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1494
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1495
|
-
options: asyncResults,
|
|
1496
|
-
showSearch: true,
|
|
1497
|
-
customPopupRender: true,
|
|
1498
|
-
onSearch: mockOnSearch,
|
|
1499
|
-
searchDebounce: 300,
|
|
1500
|
-
resetSearch: true,
|
|
1501
|
-
staticValue: false
|
|
1502
|
-
}));
|
|
1503
|
-
yield waitFor(() => {
|
|
1504
|
-
expect(screen.getByText('Async Option 1')).toBeInTheDocument();
|
|
1505
|
-
expect(screen.getByText('Async Option 2')).toBeInTheDocument();
|
|
1506
|
-
});
|
|
1507
|
-
var option = screen.getByText('Async Option 1');
|
|
1508
|
-
yield user.click(option);
|
|
1509
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1510
|
-
yield user.click(confirmButton);
|
|
1511
|
-
yield waitFor(() => {
|
|
1512
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1513
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1514
|
-
}, {
|
|
1515
|
-
timeout: 2000
|
|
1516
|
-
});
|
|
1517
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1518
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1519
|
-
options: options,
|
|
1520
|
-
showSearch: true,
|
|
1521
|
-
customPopupRender: true,
|
|
1522
|
-
onSearch: mockOnSearch,
|
|
1523
|
-
searchDebounce: 300,
|
|
1524
|
-
resetSearch: true,
|
|
1525
|
-
staticValue: false
|
|
1526
|
-
}));
|
|
1527
|
-
yield user.click(selector);
|
|
1528
|
-
yield waitFor(() => {
|
|
1529
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1530
|
-
expect(dropdown).not.toHaveClass('ant-select-dropdown-hidden');
|
|
1531
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1532
|
-
expect(screen.queryByText('Async Option 1')).not.toBeInTheDocument();
|
|
1533
|
-
expect(screen.queryByText('Async Option 2')).not.toBeInTheDocument();
|
|
1534
|
-
});
|
|
1535
|
-
}));
|
|
1536
|
-
it('should set isSearching to false when resetSearch is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1537
|
-
var asyncResults = mockSimpleAsyncResult;
|
|
1538
|
-
var mockOnSearch = jest.fn(() => new Promise(resolve => setTimeout(() => resolve(asyncResults), 100)));
|
|
1539
|
-
var user = userEvent.setup({
|
|
1540
|
-
delay: null
|
|
1541
|
-
});
|
|
1542
|
-
var {
|
|
1543
|
-
rerender
|
|
1544
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1545
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1546
|
-
options: options,
|
|
1547
|
-
showSearch: true,
|
|
1548
|
-
customPopupRender: true,
|
|
1549
|
-
onSearch: mockOnSearch,
|
|
1550
|
-
searchDebounce: 300,
|
|
1551
|
-
resetSearch: true,
|
|
1552
|
-
staticValue: false
|
|
1553
|
-
}));
|
|
1554
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1555
|
-
expect(selector).toBeTruthy();
|
|
1556
|
-
yield user.click(selector);
|
|
1557
|
-
yield waitFor(() => {
|
|
1558
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1559
|
-
expect(searchInput).toBeInTheDocument();
|
|
1560
|
-
});
|
|
1561
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1562
|
-
expect(searchInput).toBeTruthy();
|
|
1563
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1564
|
-
yield user.type(searchInput, 'res');
|
|
1565
|
-
}));
|
|
1566
|
-
jest.advanceTimersByTime(300);
|
|
1567
|
-
yield waitFor(() => {
|
|
1568
|
-
expect(mockOnSearch).toHaveBeenCalledWith('res');
|
|
1569
|
-
});
|
|
1570
|
-
jest.advanceTimersByTime(100);
|
|
1571
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1572
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1573
|
-
options: asyncResults,
|
|
1574
|
-
showSearch: true,
|
|
1575
|
-
customPopupRender: true,
|
|
1576
|
-
onSearch: mockOnSearch,
|
|
1577
|
-
searchDebounce: 300,
|
|
1578
|
-
resetSearch: true,
|
|
1579
|
-
staticValue: false
|
|
1580
|
-
}));
|
|
1581
|
-
yield waitFor(() => {
|
|
1582
|
-
expect(screen.getByText('Result')).toBeInTheDocument();
|
|
1583
|
-
});
|
|
1584
|
-
var option = screen.getByText('Result');
|
|
1585
|
-
yield user.click(option);
|
|
1586
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1587
|
-
yield user.click(confirmButton);
|
|
1588
|
-
yield waitFor(() => {
|
|
1589
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1590
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1591
|
-
}, {
|
|
1592
|
-
timeout: 2000
|
|
1593
|
-
});
|
|
1594
|
-
yield user.click(selector);
|
|
1595
|
-
yield waitFor(() => {
|
|
1596
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1597
|
-
expect(dropdown).not.toHaveClass('ant-select-dropdown-hidden');
|
|
1598
|
-
var searchInputAfter = document.querySelector('input[placeholder="Search"]');
|
|
1599
|
-
expect(searchInputAfter).toBeInTheDocument();
|
|
1600
|
-
expect(searchInputAfter.value).toBe('');
|
|
1601
|
-
});
|
|
1602
|
-
}));
|
|
1603
|
-
it('should close dropdown after confirm button is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1604
|
-
var user = userEvent.setup({
|
|
1605
|
-
delay: null
|
|
1606
|
-
});
|
|
1607
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1608
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1609
|
-
options: options,
|
|
1610
|
-
customPopupRender: true
|
|
1611
|
-
}));
|
|
1612
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1613
|
-
expect(selector).toBeTruthy();
|
|
1614
|
-
yield user.click(selector);
|
|
1615
|
-
yield waitFor(() => {
|
|
1616
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1617
|
-
});
|
|
1618
|
-
yield user.click(screen.getByText('Option 1'));
|
|
1619
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1620
|
-
expect(confirmButton).toBeInTheDocument();
|
|
1621
|
-
yield user.click(confirmButton);
|
|
1622
|
-
yield waitFor(() => {
|
|
1623
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1624
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1625
|
-
}, {
|
|
1626
|
-
timeout: 2000
|
|
1627
|
-
});
|
|
1628
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1629
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1630
|
-
var option2 = screen.queryByText('Option 2');
|
|
1631
|
-
if (option2) {
|
|
1632
|
-
var isInHiddenDropdown = option2.closest('.ant-select-dropdown-hidden') !== null;
|
|
1633
|
-
expect(isInHiddenDropdown).toBe(true);
|
|
1634
|
-
} else {
|
|
1635
|
-
expect(option2).toBeNull();
|
|
1636
|
-
}
|
|
1637
|
-
}));
|
|
1638
|
-
it('should call onChange with tempValue when confirm is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1639
|
-
var handleChange = jest.fn();
|
|
1640
|
-
var user = userEvent.setup({
|
|
1641
|
-
delay: null
|
|
1642
|
-
});
|
|
1643
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1644
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1645
|
-
options: options,
|
|
1646
|
-
onChange: handleChange,
|
|
1647
|
-
customPopupRender: true
|
|
1648
|
-
}));
|
|
1649
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1650
|
-
expect(selector).toBeTruthy();
|
|
1651
|
-
yield user.click(selector);
|
|
1652
|
-
yield waitFor(() => {
|
|
1653
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1654
|
-
});
|
|
1655
|
-
yield user.click(screen.getByText('Option 1'));
|
|
1656
|
-
yield user.click(screen.getByText('Option 2'));
|
|
1657
|
-
var confirmButton = screen.getByText('Confirm');
|
|
1658
|
-
yield user.click(confirmButton);
|
|
1659
|
-
expect(handleChange).toHaveBeenCalled();
|
|
1660
|
-
var callArgs = handleChange.mock.calls[0][0];
|
|
1661
|
-
expect(Array.isArray(callArgs)).toBe(true);
|
|
1662
|
-
expect(callArgs).toContain('1');
|
|
1663
|
-
expect(callArgs).toContain('2');
|
|
1664
|
-
}));
|
|
1665
|
-
});
|
|
1666
|
-
describe('Additional Branch Coverage', () => {
|
|
1667
|
-
it('should handle clear all for single select (isMulti false)', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1668
|
-
var handleChange = jest.fn();
|
|
1669
|
-
var user = userEvent.setup();
|
|
1670
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1671
|
-
type: SELECT_TYPES.SELECT,
|
|
1672
|
-
options: options,
|
|
1673
|
-
value: "1",
|
|
1674
|
-
onChange: handleChange,
|
|
1675
|
-
allowClear: true,
|
|
1676
|
-
customPopupRender: true
|
|
1677
|
-
}));
|
|
1678
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1679
|
-
expect(selector).toBeTruthy();
|
|
1680
|
-
yield user.click(selector);
|
|
1681
|
-
yield waitFor(() => {
|
|
1682
|
-
expect(screen.getByText(DEFAULTS.CLEAR_TEXT)).toBeInTheDocument();
|
|
1683
|
-
});
|
|
1684
|
-
var clearButton = screen.getByText(DEFAULTS.CLEAR_TEXT);
|
|
1685
|
-
yield user.click(clearButton);
|
|
1686
|
-
expect(handleChange).toHaveBeenCalled();
|
|
1687
|
-
expect(handleChange.mock.calls[0][0]).toBeUndefined();
|
|
1688
|
-
}));
|
|
1689
|
-
it('should call onFooterDownloadChange when footer download is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1690
|
-
var handleFooterDownload = jest.fn();
|
|
1691
|
-
var user = userEvent.setup();
|
|
1692
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1693
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1694
|
-
options: options,
|
|
1695
|
-
value: ['1', '2'],
|
|
1696
|
-
onFooterDownloadChange: handleFooterDownload,
|
|
1697
|
-
customPopupRender: true
|
|
1698
|
-
}));
|
|
1699
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1700
|
-
expect(selector).toBeTruthy();
|
|
1701
|
-
yield user.click(selector);
|
|
1702
|
-
yield waitFor(() => {
|
|
1703
|
-
expect(screen.getByText('2 selected')).toBeInTheDocument();
|
|
1704
|
-
});
|
|
1705
|
-
var downloadButton = screen.getByText('2 selected').closest('div');
|
|
1706
|
-
if (downloadButton) {
|
|
1707
|
-
yield user.click(downloadButton);
|
|
1708
|
-
expect(handleFooterDownload).toHaveBeenCalledWith(['1', '2']);
|
|
1709
|
-
}
|
|
1710
|
-
}));
|
|
1711
|
-
it('should call onUpload when upload button is clicked', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1712
|
-
var handleUpload = jest.fn();
|
|
1713
|
-
var user = userEvent.setup();
|
|
1714
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1715
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1716
|
-
options: options,
|
|
1717
|
-
onUpload: handleUpload,
|
|
1718
|
-
showUpload: true,
|
|
1719
|
-
customPopupRender: true
|
|
1720
|
-
}));
|
|
1721
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1722
|
-
expect(selector).toBeTruthy();
|
|
1723
|
-
yield user.click(selector);
|
|
1724
|
-
yield waitFor(() => {
|
|
1725
|
-
expect(screen.getByText(DEFAULTS.UPLOAD_LABEL)).toBeInTheDocument();
|
|
1726
|
-
});
|
|
1727
|
-
var uploadButton = screen.getByText(DEFAULTS.UPLOAD_LABEL).closest('div');
|
|
1728
|
-
if (uploadButton) {
|
|
1729
|
-
yield user.click(uploadButton);
|
|
1730
|
-
expect(handleUpload).toHaveBeenCalled();
|
|
1731
|
-
}
|
|
1732
|
-
}));
|
|
1733
|
-
it('should display uploaded values in dropdown even when they are not in options array', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1734
|
-
var user = userEvent.setup();
|
|
1735
|
-
var uploadedValue = 'uploaded-value-123';
|
|
1736
|
-
|
|
1737
|
-
// Render with value that doesn't exist in options
|
|
1738
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1739
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1740
|
-
options: options,
|
|
1741
|
-
value: [uploadedValue],
|
|
1742
|
-
showUpload: true,
|
|
1743
|
-
customPopupRender: true
|
|
1744
|
-
}));
|
|
1745
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1746
|
-
expect(selector).toBeTruthy();
|
|
1747
|
-
yield user.click(selector);
|
|
1748
|
-
yield waitFor(() => {
|
|
1749
|
-
expect(screen.getByText(DEFAULTS.UPLOAD_LABEL)).toBeInTheDocument();
|
|
1750
|
-
});
|
|
1751
|
-
yield waitFor(() => {
|
|
1752
|
-
var uploadedOptions = screen.getAllByText(uploadedValue);
|
|
1753
|
-
expect(uploadedOptions.length).toBeGreaterThanOrEqual(1);
|
|
1754
|
-
var dropdownContainer = document.querySelector('.ant-select-dropdown');
|
|
1755
|
-
if (dropdownContainer) {
|
|
1756
|
-
var optionInDropdown = uploadedOptions.some(el => dropdownContainer.contains(el));
|
|
1757
|
-
expect(optionInDropdown).toBe(true);
|
|
1758
|
-
} else {
|
|
1759
|
-
expect(uploadedOptions.length).toBeGreaterThan(0);
|
|
1760
|
-
}
|
|
1761
|
-
});
|
|
1762
|
-
}));
|
|
1763
|
-
it('should display uploaded values with cached labels when available', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1764
|
-
var user = userEvent.setup();
|
|
1765
|
-
var uploadedValue = 'cached-value-456';
|
|
1766
|
-
var cachedLabel = 'Cached Uploaded Item';
|
|
1767
|
-
var {
|
|
1768
|
-
rerender
|
|
1769
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1770
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1771
|
-
options: [...options, {
|
|
1772
|
-
label: cachedLabel,
|
|
1773
|
-
value: uploadedValue
|
|
1774
|
-
}],
|
|
1775
|
-
value: [uploadedValue],
|
|
1776
|
-
showUpload: true,
|
|
1777
|
-
customPopupRender: true
|
|
1778
|
-
}));
|
|
1779
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1780
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1781
|
-
options: options,
|
|
1782
|
-
value: [uploadedValue],
|
|
1783
|
-
showUpload: true,
|
|
1784
|
-
customPopupRender: true
|
|
1785
|
-
}));
|
|
1786
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1787
|
-
expect(selector).toBeTruthy();
|
|
1788
|
-
yield user.click(selector);
|
|
1789
|
-
yield waitFor(() => {
|
|
1790
|
-
expect(screen.getByText(DEFAULTS.UPLOAD_LABEL)).toBeInTheDocument();
|
|
1791
|
-
});
|
|
1792
|
-
yield waitFor(() => {
|
|
1793
|
-
var uploadedOptions = screen.getAllByText(cachedLabel);
|
|
1794
|
-
expect(uploadedOptions.length).toBeGreaterThanOrEqual(1);
|
|
1795
|
-
var dropdownContainer = document.querySelector('.ant-select-dropdown');
|
|
1796
|
-
if (dropdownContainer) {
|
|
1797
|
-
var optionInDropdown = uploadedOptions.some(el => dropdownContainer.contains(el));
|
|
1798
|
-
expect(optionInDropdown).toBe(true);
|
|
1799
|
-
} else {
|
|
1800
|
-
expect(uploadedOptions.length).toBeGreaterThan(0);
|
|
1801
|
-
}
|
|
1802
|
-
});
|
|
1803
|
-
}));
|
|
1804
|
-
it('should keep uploaded values visible during search', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1805
|
-
var user = userEvent.setup();
|
|
1806
|
-
var uploadedValue = 'uploaded-search-test';
|
|
1807
|
-
var searchQuery = 'Option 1';
|
|
1808
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1809
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1810
|
-
options: options,
|
|
1811
|
-
value: [uploadedValue],
|
|
1812
|
-
showUpload: true,
|
|
1813
|
-
showSearch: true,
|
|
1814
|
-
customPopupRender: true
|
|
1815
|
-
}));
|
|
1816
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1817
|
-
expect(selector).toBeTruthy();
|
|
1818
|
-
yield user.click(selector);
|
|
1819
|
-
yield waitFor(() => {
|
|
1820
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1821
|
-
expect(searchInput).toBeInTheDocument();
|
|
1822
|
-
});
|
|
1823
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1824
|
-
expect(searchInput).toBeTruthy();
|
|
1825
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1826
|
-
yield user.type(searchInput, searchQuery);
|
|
1827
|
-
}));
|
|
1828
|
-
yield waitFor(() => {
|
|
1829
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1830
|
-
});
|
|
1831
|
-
yield waitFor(() => {
|
|
1832
|
-
var uploadedOptions = screen.getAllByText(uploadedValue);
|
|
1833
|
-
expect(uploadedOptions.length).toBeGreaterThanOrEqual(1);
|
|
1834
|
-
var dropdownContainer = document.querySelector('.ant-select-dropdown');
|
|
1835
|
-
if (dropdownContainer) {
|
|
1836
|
-
var optionInDropdown = uploadedOptions.some(el => dropdownContainer.contains(el));
|
|
1837
|
-
expect(optionInDropdown).toBe(true);
|
|
1838
|
-
} else {
|
|
1839
|
-
expect(uploadedOptions.length).toBeGreaterThan(0);
|
|
1840
|
-
}
|
|
1841
|
-
});
|
|
1842
|
-
}));
|
|
1843
|
-
it('should handle search keydown for Backspace key', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1844
|
-
var user = userEvent.setup();
|
|
1845
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1846
|
-
options: options,
|
|
1847
|
-
showSearch: true,
|
|
1848
|
-
customPopupRender: true
|
|
1849
|
-
}));
|
|
1850
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1851
|
-
expect(selector).toBeTruthy();
|
|
1852
|
-
yield user.click(selector);
|
|
1853
|
-
yield waitFor(() => {
|
|
1854
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1855
|
-
expect(searchInput).toBeInTheDocument();
|
|
1856
|
-
});
|
|
1857
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1858
|
-
expect(searchInput).toBeTruthy();
|
|
1859
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1860
|
-
yield user.type(searchInput, 'test');
|
|
1861
|
-
}));
|
|
1862
|
-
yield user.keyboard('{Backspace}');
|
|
1863
|
-
expect(searchInput.value).toBe('tes');
|
|
1864
|
-
}));
|
|
1865
|
-
it('should handle search keydown for Delete key', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1866
|
-
var user = userEvent.setup();
|
|
1867
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1868
|
-
options: options,
|
|
1869
|
-
showSearch: true,
|
|
1870
|
-
customPopupRender: true
|
|
1871
|
-
}));
|
|
1872
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1873
|
-
expect(selector).toBeTruthy();
|
|
1874
|
-
yield user.click(selector);
|
|
1875
|
-
yield waitFor(() => {
|
|
1876
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1877
|
-
expect(searchInput).toBeInTheDocument();
|
|
1878
|
-
});
|
|
1879
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1880
|
-
expect(searchInput).toBeTruthy();
|
|
1881
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1882
|
-
yield user.type(searchInput, 'test');
|
|
1883
|
-
}));
|
|
1884
|
-
searchInput.setSelectionRange(2, 2);
|
|
1885
|
-
yield user.keyboard('{Delete}');
|
|
1886
|
-
expect(searchInput.value.length).toBeLessThan(4);
|
|
1887
|
-
}));
|
|
1888
|
-
it('should handle search keydown for Escape key when search text exists', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1889
|
-
var user = userEvent.setup();
|
|
1890
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1891
|
-
options: options,
|
|
1892
|
-
showSearch: true,
|
|
1893
|
-
customPopupRender: true
|
|
1894
|
-
}));
|
|
1895
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1896
|
-
expect(selector).toBeTruthy();
|
|
1897
|
-
yield user.click(selector);
|
|
1898
|
-
yield waitFor(() => {
|
|
1899
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1900
|
-
expect(searchInput).toBeInTheDocument();
|
|
1901
|
-
});
|
|
1902
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
1903
|
-
expect(searchInput).toBeTruthy();
|
|
1904
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
1905
|
-
yield user.type(searchInput, 'test');
|
|
1906
|
-
}));
|
|
1907
|
-
yield user.keyboard('{Escape}');
|
|
1908
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1909
|
-
expect(dropdown).not.toHaveClass('ant-select-dropdown-hidden');
|
|
1910
|
-
}));
|
|
1911
|
-
it('should not open dropdown when readOnly is true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1912
|
-
var user = userEvent.setup();
|
|
1913
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1914
|
-
options: options,
|
|
1915
|
-
readOnly: true,
|
|
1916
|
-
customPopupRender: true
|
|
1917
|
-
}));
|
|
1918
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1919
|
-
expect(selector).toBeTruthy();
|
|
1920
|
-
yield user.click(selector);
|
|
1921
|
-
yield waitFor(() => {
|
|
1922
|
-
var dropdown = document.querySelector('.ant-select-dropdown');
|
|
1923
|
-
if (dropdown) {
|
|
1924
|
-
expect(dropdown).toHaveClass('ant-select-dropdown-hidden');
|
|
1925
|
-
} else {
|
|
1926
|
-
expect(dropdown).toBeNull();
|
|
1927
|
-
}
|
|
1928
|
-
}, {
|
|
1929
|
-
timeout: 1000
|
|
1930
|
-
});
|
|
1931
|
-
}));
|
|
1932
|
-
it('should call onChange when dropdown closes with customPopupRender false', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1933
|
-
var handleChange = jest.fn();
|
|
1934
|
-
var user = userEvent.setup();
|
|
1935
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1936
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1937
|
-
options: options,
|
|
1938
|
-
onChange: handleChange,
|
|
1939
|
-
customPopupRender: false
|
|
1940
|
-
}));
|
|
1941
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1942
|
-
expect(selector).toBeTruthy();
|
|
1943
|
-
yield user.click(selector);
|
|
1944
|
-
yield waitFor(() => {
|
|
1945
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1946
|
-
});
|
|
1947
|
-
yield user.click(screen.getByText('Option 1'));
|
|
1948
|
-
yield user.click(document.body);
|
|
1949
|
-
yield waitFor(() => {
|
|
1950
|
-
expect(handleChange).toHaveBeenCalled();
|
|
1951
|
-
}, {
|
|
1952
|
-
timeout: 2000
|
|
1953
|
-
});
|
|
1954
|
-
}));
|
|
1955
|
-
it('should merge paginated options with original options when onPopupScroll is provided', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1956
|
-
var mockOnScroll = jest.fn().mockResolvedValue([{
|
|
1957
|
-
label: 'Paginated Option 1',
|
|
1958
|
-
value: 'page1'
|
|
1959
|
-
}, {
|
|
1960
|
-
label: 'Paginated Option 2',
|
|
1961
|
-
value: 'page2'
|
|
1962
|
-
}]);
|
|
1963
|
-
var user = userEvent.setup();
|
|
1964
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1965
|
-
options: options,
|
|
1966
|
-
onPopupScroll: mockOnScroll,
|
|
1967
|
-
customPopupRender: true
|
|
1968
|
-
}));
|
|
1969
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1970
|
-
expect(selector).toBeTruthy();
|
|
1971
|
-
yield user.click(selector);
|
|
1972
|
-
yield waitFor(() => {
|
|
1973
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
1974
|
-
});
|
|
1975
|
-
expect(mockOnScroll).not.toHaveBeenCalled();
|
|
1976
|
-
}));
|
|
1977
|
-
it('should handle handleFooterDownload with single value', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
1978
|
-
var handleFooterDownload = jest.fn();
|
|
1979
|
-
var user = userEvent.setup();
|
|
1980
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
1981
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
1982
|
-
options: options,
|
|
1983
|
-
value: ['1'],
|
|
1984
|
-
onFooterDownloadChange: handleFooterDownload,
|
|
1985
|
-
customPopupRender: true
|
|
1986
|
-
}));
|
|
1987
|
-
var selector = document.querySelector('.ant-select-content');
|
|
1988
|
-
expect(selector).toBeTruthy();
|
|
1989
|
-
yield user.click(selector);
|
|
1990
|
-
yield waitFor(() => {
|
|
1991
|
-
var downloadText = screen.queryByText('1 selected');
|
|
1992
|
-
expect(downloadText).toBeInTheDocument();
|
|
1993
|
-
});
|
|
1994
|
-
var downloadText = screen.getByText('1 selected');
|
|
1995
|
-
var downloadButton = downloadText.closest('div');
|
|
1996
|
-
if (downloadButton) {
|
|
1997
|
-
yield user.click(downloadButton);
|
|
1998
|
-
expect(handleFooterDownload).toHaveBeenCalled();
|
|
1999
|
-
expect(Array.isArray(handleFooterDownload.mock.calls[0][0])).toBe(true);
|
|
2000
|
-
expect(handleFooterDownload.mock.calls[0][0]).toContain('1');
|
|
2001
|
-
}
|
|
2002
|
-
}));
|
|
2003
|
-
it('should handle handleFooterDownload with undefined tempValue', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2004
|
-
var handleFooterDownload = jest.fn();
|
|
2005
|
-
var user = userEvent.setup();
|
|
2006
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2007
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2008
|
-
options: options,
|
|
2009
|
-
onFooterDownloadChange: handleFooterDownload,
|
|
2010
|
-
customPopupRender: true
|
|
2011
|
-
}));
|
|
2012
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2013
|
-
expect(selector).toBeTruthy();
|
|
2014
|
-
yield user.click(selector);
|
|
2015
|
-
yield waitFor(() => {
|
|
2016
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2017
|
-
});
|
|
2018
|
-
}));
|
|
2019
|
-
it('should reset pagination when search text changes', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2020
|
-
var mockOnScroll = jest.fn().mockResolvedValue([]);
|
|
2021
|
-
var user = userEvent.setup();
|
|
2022
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2023
|
-
options: options,
|
|
2024
|
-
onPopupScroll: mockOnScroll,
|
|
2025
|
-
showSearch: true,
|
|
2026
|
-
customPopupRender: true
|
|
2027
|
-
}));
|
|
2028
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2029
|
-
expect(selector).toBeTruthy();
|
|
2030
|
-
yield user.click(selector);
|
|
2031
|
-
yield waitFor(() => {
|
|
2032
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
2033
|
-
expect(searchInput).toBeInTheDocument();
|
|
2034
|
-
});
|
|
2035
|
-
var searchInput = document.querySelector("input[placeholder=\"" + DEFAULTS.SEARCH_PLACEHOLDER + "\"]");
|
|
2036
|
-
expect(searchInput).toBeTruthy();
|
|
2037
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
2038
|
-
yield user.type(searchInput, 'test');
|
|
2039
|
-
}));
|
|
2040
|
-
expect(searchInput.value).toBe('test');
|
|
2041
|
-
}));
|
|
2042
|
-
it('should reset pagination when dropdown opens', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2043
|
-
var mockOnScroll = jest.fn().mockResolvedValue([]);
|
|
2044
|
-
var user = userEvent.setup();
|
|
2045
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2046
|
-
options: options,
|
|
2047
|
-
onPopupScroll: mockOnScroll,
|
|
2048
|
-
customPopupRender: true
|
|
2049
|
-
}));
|
|
2050
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2051
|
-
expect(selector).toBeTruthy();
|
|
2052
|
-
yield user.click(selector);
|
|
2053
|
-
yield waitFor(() => {
|
|
2054
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2055
|
-
});
|
|
2056
|
-
|
|
2057
|
-
// The branch: else if (dropdownOpen) should be covered
|
|
2058
|
-
// This happens when dropdown opens without search text
|
|
2059
|
-
}));
|
|
2060
|
-
it('should handle options with pre-rendered React element titles', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2061
|
-
var optionsWithReactTitle = getMockOptionsWithReactTitle();
|
|
2062
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2063
|
-
options: optionsWithReactTitle,
|
|
2064
|
-
customPopupRender: true
|
|
2065
|
-
}));
|
|
2066
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2067
|
-
expect(selector).toBeTruthy();
|
|
2068
|
-
var user = userEvent.setup();
|
|
2069
|
-
yield user.click(selector);
|
|
2070
|
-
yield waitFor(() => {
|
|
2071
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2072
|
-
});
|
|
2073
|
-
}));
|
|
2074
|
-
it('should reset tempValue to value when customPopupRender is true and dropdown closes', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2075
|
-
var user = userEvent.setup();
|
|
2076
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2077
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2078
|
-
options: options,
|
|
2079
|
-
value: ['1'],
|
|
2080
|
-
customPopupRender: true
|
|
2081
|
-
}));
|
|
2082
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2083
|
-
expect(selector).toBeTruthy();
|
|
2084
|
-
yield user.click(selector);
|
|
2085
|
-
yield waitFor(() => {
|
|
2086
|
-
var option1Elements = screen.getAllByText('Option 1');
|
|
2087
|
-
expect(option1Elements.length).toBeGreaterThan(0);
|
|
2088
|
-
});
|
|
2089
|
-
var option2Elements = screen.getAllByText('Option 2');
|
|
2090
|
-
if (option2Elements.length > 0) {
|
|
2091
|
-
yield user.click(option2Elements[0]);
|
|
2092
|
-
}
|
|
2093
|
-
yield user.click(document.body);
|
|
2094
|
-
yield waitFor(() => {
|
|
2095
|
-
expect(selector).toBeInTheDocument();
|
|
2096
|
-
}, {
|
|
2097
|
-
timeout: 1000
|
|
2098
|
-
});
|
|
2099
|
-
}));
|
|
2100
|
-
});
|
|
2101
|
-
describe('resetData fallback timeout', () => {
|
|
2102
|
-
beforeEach(() => {
|
|
2103
|
-
jest.useFakeTimers();
|
|
2104
|
-
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
2105
|
-
});
|
|
2106
|
-
afterEach(() => {
|
|
2107
|
-
jest.runOnlyPendingTimers();
|
|
2108
|
-
jest.useRealTimers();
|
|
2109
|
-
jest.restoreAllMocks();
|
|
2110
|
-
});
|
|
2111
|
-
it('should clear isResettingData after 1 second timeout when options do not update', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2112
|
-
var mockResetData = jest.fn();
|
|
2113
|
-
var user = userEvent.setup({
|
|
2114
|
-
delay: null
|
|
2115
|
-
});
|
|
2116
|
-
var {
|
|
2117
|
-
container
|
|
2118
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2119
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2120
|
-
options: options,
|
|
2121
|
-
customPopupRender: true,
|
|
2122
|
-
resetData: mockResetData
|
|
2123
|
-
}));
|
|
2124
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2125
|
-
expect(selector).toBeTruthy();
|
|
2126
|
-
yield user.click(selector);
|
|
2127
|
-
yield waitFor(() => {
|
|
2128
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2129
|
-
});
|
|
2130
|
-
yield user.click(screen.getByText('Option 1'));
|
|
2131
|
-
var confirmButton = screen.getByText('Confirm');
|
|
2132
|
-
yield user.click(confirmButton);
|
|
2133
|
-
expect(mockResetData).toHaveBeenCalled();
|
|
2134
|
-
jest.advanceTimersByTime(1000);
|
|
2135
|
-
yield user.click(selector);
|
|
2136
|
-
yield waitFor(() => {
|
|
2137
|
-
var optionElements = screen.getAllByText('Option 1');
|
|
2138
|
-
expect(optionElements.length).toBeGreaterThan(0);
|
|
2139
|
-
});
|
|
2140
|
-
var loadingOverlay = container.querySelector('.cap-unified-select-loading-overlay');
|
|
2141
|
-
expect(loadingOverlay).not.toBeInTheDocument();
|
|
2142
|
-
}));
|
|
2143
|
-
it('should update prevOptionsBeforeResetRef and clear resetDataCalledTimeRef when timeout fires', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2144
|
-
var mockResetData = jest.fn();
|
|
2145
|
-
var user = userEvent.setup({
|
|
2146
|
-
delay: null
|
|
2147
|
-
});
|
|
2148
|
-
var initialOptions = mockInitialOptions;
|
|
2149
|
-
var {
|
|
2150
|
-
container
|
|
2151
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2152
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2153
|
-
options: initialOptions,
|
|
2154
|
-
customPopupRender: true,
|
|
2155
|
-
resetData: mockResetData
|
|
2156
|
-
}));
|
|
2157
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2158
|
-
expect(selector).toBeTruthy();
|
|
2159
|
-
yield user.click(selector);
|
|
2160
|
-
yield waitFor(() => {
|
|
2161
|
-
expect(screen.getByText('Initial Option 1')).toBeInTheDocument();
|
|
2162
|
-
});
|
|
2163
|
-
yield user.click(screen.getByText('Initial Option 1'));
|
|
2164
|
-
var confirmButton = screen.getByText('Confirm');
|
|
2165
|
-
yield user.click(confirmButton);
|
|
2166
|
-
expect(mockResetData).toHaveBeenCalled();
|
|
2167
|
-
jest.advanceTimersByTime(1000);
|
|
2168
|
-
yield user.click(selector);
|
|
2169
|
-
yield waitFor(() => {
|
|
2170
|
-
var optionElements = screen.getAllByText('Initial Option 1');
|
|
2171
|
-
expect(optionElements.length).toBeGreaterThan(0);
|
|
2172
|
-
});
|
|
2173
|
-
var loadingOverlay = container.querySelector('.cap-unified-select-loading-overlay');
|
|
2174
|
-
expect(loadingOverlay).not.toBeInTheDocument();
|
|
2175
|
-
}));
|
|
2176
|
-
it('should cleanup timeout when component unmounts', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2177
|
-
var mockResetData = jest.fn();
|
|
2178
|
-
var user = userEvent.setup({
|
|
2179
|
-
delay: null
|
|
2180
|
-
});
|
|
2181
|
-
var clearTimeoutSpy = jest.spyOn(global, 'clearTimeout');
|
|
2182
|
-
var {
|
|
2183
|
-
unmount
|
|
2184
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2185
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2186
|
-
options: options,
|
|
2187
|
-
customPopupRender: true,
|
|
2188
|
-
resetData: mockResetData
|
|
2189
|
-
}));
|
|
2190
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2191
|
-
expect(selector).toBeTruthy();
|
|
2192
|
-
yield user.click(selector);
|
|
2193
|
-
yield waitFor(() => {
|
|
2194
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2195
|
-
});
|
|
2196
|
-
yield user.click(screen.getByText('Option 1'));
|
|
2197
|
-
var confirmButton = screen.getByText('Confirm');
|
|
2198
|
-
yield user.click(confirmButton);
|
|
2199
|
-
expect(mockResetData).toHaveBeenCalled();
|
|
2200
|
-
unmount();
|
|
2201
|
-
expect(clearTimeoutSpy).toHaveBeenCalled();
|
|
2202
|
-
clearTimeoutSpy.mockRestore();
|
|
2203
|
-
}));
|
|
2204
|
-
it('should cleanup timeout when options change and dependency updates', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2205
|
-
var mockResetData = jest.fn();
|
|
2206
|
-
var user = userEvent.setup({
|
|
2207
|
-
delay: null
|
|
2208
|
-
});
|
|
2209
|
-
var clearTimeoutSpy = jest.spyOn(global, 'clearTimeout');
|
|
2210
|
-
var {
|
|
2211
|
-
rerender
|
|
2212
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2213
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2214
|
-
options: options,
|
|
2215
|
-
customPopupRender: true,
|
|
2216
|
-
resetData: mockResetData
|
|
2217
|
-
}));
|
|
2218
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2219
|
-
expect(selector).toBeTruthy();
|
|
2220
|
-
yield user.click(selector);
|
|
2221
|
-
yield waitFor(() => {
|
|
2222
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2223
|
-
});
|
|
2224
|
-
yield user.click(screen.getByText('Option 1'));
|
|
2225
|
-
var confirmButton = screen.getByText('Confirm');
|
|
2226
|
-
yield user.click(confirmButton);
|
|
2227
|
-
expect(mockResetData).toHaveBeenCalled();
|
|
2228
|
-
var newOptions = mockNewOptions;
|
|
2229
|
-
rerender(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2230
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2231
|
-
options: newOptions,
|
|
2232
|
-
customPopupRender: true,
|
|
2233
|
-
resetData: mockResetData
|
|
2234
|
-
}));
|
|
2235
|
-
expect(clearTimeoutSpy).toHaveBeenCalled();
|
|
2236
|
-
clearTimeoutSpy.mockRestore();
|
|
2237
|
-
}));
|
|
2238
|
-
it('should handle timeout when options change but isResettingData remains true', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2239
|
-
var mockResetData = jest.fn();
|
|
2240
|
-
var user = userEvent.setup({
|
|
2241
|
-
delay: null
|
|
2242
|
-
});
|
|
2243
|
-
var {
|
|
2244
|
-
container
|
|
2245
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2246
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2247
|
-
options: options,
|
|
2248
|
-
customPopupRender: true,
|
|
2249
|
-
resetData: mockResetData
|
|
2250
|
-
}));
|
|
2251
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2252
|
-
expect(selector).toBeTruthy();
|
|
2253
|
-
yield user.click(selector);
|
|
2254
|
-
yield waitFor(() => {
|
|
2255
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2256
|
-
});
|
|
2257
|
-
yield user.click(screen.getByText('Option 1'));
|
|
2258
|
-
var confirmButton = screen.getByText('Confirm');
|
|
2259
|
-
yield user.click(confirmButton);
|
|
2260
|
-
expect(mockResetData).toHaveBeenCalled();
|
|
2261
|
-
jest.advanceTimersByTime(1000);
|
|
2262
|
-
yield user.click(selector);
|
|
2263
|
-
yield waitFor(() => {
|
|
2264
|
-
var optionElements = screen.getAllByText('Option 1');
|
|
2265
|
-
expect(optionElements.length).toBeGreaterThan(0);
|
|
2266
|
-
});
|
|
2267
|
-
var loadingOverlay = container.querySelector('.cap-unified-select-loading-overlay');
|
|
2268
|
-
expect(loadingOverlay).not.toBeInTheDocument();
|
|
2269
|
-
}));
|
|
2270
|
-
});
|
|
2271
|
-
describe('handleScroll - onPopupScroll functionality', () => {
|
|
2272
|
-
beforeEach(() => {
|
|
2273
|
-
jest.useFakeTimers();
|
|
2274
|
-
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
2275
|
-
});
|
|
2276
|
-
afterEach(() => {
|
|
2277
|
-
jest.runOnlyPendingTimers();
|
|
2278
|
-
jest.useRealTimers();
|
|
2279
|
-
jest.restoreAllMocks();
|
|
2280
|
-
});
|
|
2281
|
-
var setupScrollContainer = function setupScrollContainer(scrollHeight, clientHeight) {
|
|
2282
|
-
if (scrollHeight === void 0) {
|
|
2283
|
-
scrollHeight = 1000;
|
|
2284
|
-
}
|
|
2285
|
-
if (clientHeight === void 0) {
|
|
2286
|
-
clientHeight = 100;
|
|
2287
|
-
}
|
|
2288
|
-
var scrollContainer = document.querySelector('.ant-select-tree-list-holder');
|
|
2289
|
-
if (scrollContainer) {
|
|
2290
|
-
Object.defineProperty(scrollContainer, 'scrollHeight', {
|
|
2291
|
-
value: scrollHeight,
|
|
2292
|
-
writable: true,
|
|
2293
|
-
configurable: true
|
|
2294
|
-
});
|
|
2295
|
-
Object.defineProperty(scrollContainer, 'clientHeight', {
|
|
2296
|
-
value: clientHeight,
|
|
2297
|
-
writable: true,
|
|
2298
|
-
configurable: true
|
|
2299
|
-
});
|
|
2300
|
-
}
|
|
2301
|
-
return scrollContainer;
|
|
2302
|
-
};
|
|
2303
|
-
var setScrollTop = (element, value) => {
|
|
2304
|
-
Object.defineProperty(element, 'scrollTop', {
|
|
2305
|
-
get: () => value,
|
|
2306
|
-
set: () => {},
|
|
2307
|
-
configurable: true
|
|
2308
|
-
});
|
|
2309
|
-
};
|
|
2310
|
-
it('should not call onPopupScroll when onPopupScroll prop is not provided', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2311
|
-
var user = userEvent.setup({
|
|
2312
|
-
delay: null
|
|
2313
|
-
});
|
|
2314
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2315
|
-
options: options,
|
|
2316
|
-
customPopupRender: true
|
|
2317
|
-
}));
|
|
2318
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2319
|
-
expect(selector).toBeTruthy();
|
|
2320
|
-
yield user.click(selector);
|
|
2321
|
-
yield waitFor(() => {
|
|
2322
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2323
|
-
});
|
|
2324
|
-
var scrollContainer = document.querySelector('.ant-select-tree-list-holder');
|
|
2325
|
-
if (scrollContainer) {
|
|
2326
|
-
Object.defineProperty(scrollContainer, 'scrollHeight', {
|
|
2327
|
-
value: 1000,
|
|
2328
|
-
writable: true
|
|
2329
|
-
});
|
|
2330
|
-
setScrollTop(scrollContainer, 900);
|
|
2331
|
-
Object.defineProperty(scrollContainer, 'clientHeight', {
|
|
2332
|
-
value: 100,
|
|
2333
|
-
writable: true
|
|
2334
|
-
});
|
|
2335
|
-
var scrollEvent = new Event('scroll', {
|
|
2336
|
-
bubbles: true
|
|
2337
|
-
});
|
|
2338
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2339
|
-
jest.advanceTimersByTime(150);
|
|
2340
|
-
expect(scrollContainer).toBeInTheDocument();
|
|
2341
|
-
}
|
|
2342
|
-
}));
|
|
2343
|
-
it('should return early when event target is null', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2344
|
-
var mockOnPopupScroll = jest.fn();
|
|
2345
|
-
var user = userEvent.setup({
|
|
2346
|
-
delay: null
|
|
2347
|
-
});
|
|
2348
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2349
|
-
options: options,
|
|
2350
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2351
|
-
customPopupRender: true
|
|
2352
|
-
}));
|
|
2353
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2354
|
-
expect(selector).toBeTruthy();
|
|
2355
|
-
yield user.click(selector);
|
|
2356
|
-
yield waitFor(() => {
|
|
2357
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2358
|
-
});
|
|
2359
|
-
var scrollContainer = document.querySelector('.ant-select-tree-list-holder');
|
|
2360
|
-
if (scrollContainer) {
|
|
2361
|
-
expect(mockOnPopupScroll).not.toHaveBeenCalled();
|
|
2362
|
-
}
|
|
2363
|
-
}));
|
|
2364
|
-
it('should reset processing flag and return early when scroll is not near bottom', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2365
|
-
var mockOnPopupScroll = jest.fn();
|
|
2366
|
-
var user = userEvent.setup({
|
|
2367
|
-
delay: null
|
|
2368
|
-
});
|
|
2369
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2370
|
-
options: options,
|
|
2371
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2372
|
-
customPopupRender: true
|
|
2373
|
-
}));
|
|
2374
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2375
|
-
expect(selector).toBeTruthy();
|
|
2376
|
-
yield user.click(selector);
|
|
2377
|
-
yield waitFor(() => {
|
|
2378
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2379
|
-
});
|
|
2380
|
-
var scrollContainer = document.querySelector('.ant-select-tree-list-holder');
|
|
2381
|
-
if (scrollContainer) {
|
|
2382
|
-
Object.defineProperty(scrollContainer, 'scrollHeight', {
|
|
2383
|
-
value: 1000,
|
|
2384
|
-
writable: true,
|
|
2385
|
-
configurable: true
|
|
2386
|
-
});
|
|
2387
|
-
Object.defineProperty(scrollContainer, 'clientHeight', {
|
|
2388
|
-
value: 100,
|
|
2389
|
-
writable: true,
|
|
2390
|
-
configurable: true
|
|
2391
|
-
});
|
|
2392
|
-
}
|
|
2393
|
-
jest.advanceTimersByTime(100);
|
|
2394
|
-
if (scrollContainer) {
|
|
2395
|
-
setScrollTop(scrollContainer, 100);
|
|
2396
|
-
var scrollEvent = new Event('scroll', {
|
|
2397
|
-
bubbles: true
|
|
2398
|
-
});
|
|
2399
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2400
|
-
jest.advanceTimersByTime(150);
|
|
2401
|
-
expect(mockOnPopupScroll).not.toHaveBeenCalled();
|
|
2402
|
-
}
|
|
2403
|
-
}));
|
|
2404
|
-
it('should return early when already processing (isScrollProcessingRef is true)', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2405
|
-
var mockOnPopupScroll = jest.fn();
|
|
2406
|
-
var user = userEvent.setup({
|
|
2407
|
-
delay: null
|
|
2408
|
-
});
|
|
2409
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2410
|
-
options: options,
|
|
2411
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2412
|
-
customPopupRender: true
|
|
2413
|
-
}));
|
|
2414
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2415
|
-
expect(selector).toBeTruthy();
|
|
2416
|
-
yield user.click(selector);
|
|
2417
|
-
yield waitFor(() => {
|
|
2418
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2419
|
-
});
|
|
2420
|
-
var scrollContainer = setupScrollContainer();
|
|
2421
|
-
jest.advanceTimersByTime(100);
|
|
2422
|
-
if (scrollContainer) {
|
|
2423
|
-
setScrollTop(scrollContainer, 900);
|
|
2424
|
-
var scrollEvent1 = new Event('scroll', {
|
|
2425
|
-
bubbles: true
|
|
2426
|
-
});
|
|
2427
|
-
scrollContainer.dispatchEvent(scrollEvent1);
|
|
2428
|
-
jest.advanceTimersByTime(50);
|
|
2429
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2430
|
-
bubbles: true
|
|
2431
|
-
});
|
|
2432
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2433
|
-
jest.advanceTimersByTime(100);
|
|
2434
|
-
yield waitFor(() => {
|
|
2435
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2436
|
-
});
|
|
2437
|
-
}
|
|
2438
|
-
}));
|
|
2439
|
-
it('should return early when already loading (isLoadingOnScroll is true)', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2440
|
-
var mockOnPopupScroll = jest.fn();
|
|
2441
|
-
var user = userEvent.setup({
|
|
2442
|
-
delay: null
|
|
2443
|
-
});
|
|
2444
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2445
|
-
options: options,
|
|
2446
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2447
|
-
customPopupRender: true
|
|
2448
|
-
}));
|
|
2449
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2450
|
-
expect(selector).toBeTruthy();
|
|
2451
|
-
yield user.click(selector);
|
|
2452
|
-
yield waitFor(() => {
|
|
2453
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2454
|
-
});
|
|
2455
|
-
var scrollContainer = setupScrollContainer();
|
|
2456
|
-
jest.advanceTimersByTime(100);
|
|
2457
|
-
if (scrollContainer) {
|
|
2458
|
-
setScrollTop(scrollContainer, 900);
|
|
2459
|
-
var scrollEvent1 = new Event('scroll', {
|
|
2460
|
-
bubbles: true
|
|
2461
|
-
});
|
|
2462
|
-
scrollContainer.dispatchEvent(scrollEvent1);
|
|
2463
|
-
jest.advanceTimersByTime(150);
|
|
2464
|
-
yield waitFor(() => {
|
|
2465
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2466
|
-
});
|
|
2467
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2468
|
-
bubbles: true
|
|
2469
|
-
});
|
|
2470
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2471
|
-
jest.advanceTimersByTime(150);
|
|
2472
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2473
|
-
}
|
|
2474
|
-
}));
|
|
2475
|
-
it('should clear existing throttle timeout before setting new one', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2476
|
-
var mockOnPopupScroll = jest.fn();
|
|
2477
|
-
var clearTimeoutSpy = jest.spyOn(global, 'clearTimeout');
|
|
2478
|
-
var user = userEvent.setup({
|
|
2479
|
-
delay: null
|
|
2480
|
-
});
|
|
2481
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2482
|
-
options: options,
|
|
2483
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2484
|
-
customPopupRender: true
|
|
2485
|
-
}));
|
|
2486
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2487
|
-
expect(selector).toBeTruthy();
|
|
2488
|
-
yield user.click(selector);
|
|
2489
|
-
yield waitFor(() => {
|
|
2490
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2491
|
-
});
|
|
2492
|
-
var scrollContainer = setupScrollContainer();
|
|
2493
|
-
jest.advanceTimersByTime(100);
|
|
2494
|
-
if (scrollContainer) {
|
|
2495
|
-
setScrollTop(scrollContainer, 900);
|
|
2496
|
-
var scrollEvent1 = new Event('scroll', {
|
|
2497
|
-
bubbles: true
|
|
2498
|
-
});
|
|
2499
|
-
scrollContainer.dispatchEvent(scrollEvent1);
|
|
2500
|
-
jest.advanceTimersByTime(50);
|
|
2501
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2502
|
-
bubbles: true
|
|
2503
|
-
});
|
|
2504
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2505
|
-
expect(clearTimeoutSpy).toHaveBeenCalled();
|
|
2506
|
-
clearTimeoutSpy.mockRestore();
|
|
2507
|
-
}
|
|
2508
|
-
}));
|
|
2509
|
-
it('should call onPopupScroll when scroll is near bottom after throttle delay', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2510
|
-
var mockOnPopupScroll = jest.fn();
|
|
2511
|
-
var user = userEvent.setup({
|
|
2512
|
-
delay: null
|
|
2513
|
-
});
|
|
2514
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2515
|
-
options: options,
|
|
2516
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2517
|
-
customPopupRender: true
|
|
2518
|
-
}));
|
|
2519
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2520
|
-
expect(selector).toBeTruthy();
|
|
2521
|
-
yield user.click(selector);
|
|
2522
|
-
yield waitFor(() => {
|
|
2523
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2524
|
-
});
|
|
2525
|
-
var scrollContainer = setupScrollContainer();
|
|
2526
|
-
jest.advanceTimersByTime(100);
|
|
2527
|
-
if (scrollContainer) {
|
|
2528
|
-
setScrollTop(scrollContainer, 900);
|
|
2529
|
-
var scrollEvent = new Event('scroll', {
|
|
2530
|
-
bubbles: true
|
|
2531
|
-
});
|
|
2532
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2533
|
-
expect(mockOnPopupScroll).not.toHaveBeenCalled();
|
|
2534
|
-
jest.advanceTimersByTime(150);
|
|
2535
|
-
yield waitFor(() => {
|
|
2536
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2537
|
-
});
|
|
2538
|
-
}
|
|
2539
|
-
}));
|
|
2540
|
-
it('should set isLoadingOnScroll to true when scroll is near bottom', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2541
|
-
var mockOnPopupScroll = jest.fn();
|
|
2542
|
-
var user = userEvent.setup({
|
|
2543
|
-
delay: null
|
|
2544
|
-
});
|
|
2545
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2546
|
-
options: options,
|
|
2547
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2548
|
-
customPopupRender: true
|
|
2549
|
-
}));
|
|
2550
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2551
|
-
expect(selector).toBeTruthy();
|
|
2552
|
-
yield user.click(selector);
|
|
2553
|
-
yield waitFor(() => {
|
|
2554
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2555
|
-
});
|
|
2556
|
-
var scrollContainer = setupScrollContainer();
|
|
2557
|
-
jest.advanceTimersByTime(100);
|
|
2558
|
-
if (scrollContainer) {
|
|
2559
|
-
setScrollTop(scrollContainer, 900);
|
|
2560
|
-
var scrollEvent = new Event('scroll', {
|
|
2561
|
-
bubbles: true
|
|
2562
|
-
});
|
|
2563
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2564
|
-
jest.advanceTimersByTime(150);
|
|
2565
|
-
yield waitFor(() => {
|
|
2566
|
-
var loadingIndicator = document.querySelector('.cap-unified-select-scroll-loading');
|
|
2567
|
-
expect(loadingIndicator || mockOnPopupScroll).toBeTruthy();
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
|
-
}));
|
|
2571
|
-
it('should not call onPopupScroll if scroll position changes away from bottom during throttle', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2572
|
-
var mockOnPopupScroll = jest.fn();
|
|
2573
|
-
var user = userEvent.setup({
|
|
2574
|
-
delay: null
|
|
2575
|
-
});
|
|
2576
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2577
|
-
options: options,
|
|
2578
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2579
|
-
customPopupRender: true
|
|
2580
|
-
}));
|
|
2581
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2582
|
-
expect(selector).toBeTruthy();
|
|
2583
|
-
yield user.click(selector);
|
|
2584
|
-
yield waitFor(() => {
|
|
2585
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2586
|
-
});
|
|
2587
|
-
jest.advanceTimersByTime(100);
|
|
2588
|
-
var scrollContainer = document.querySelector('.ant-select-tree-list-holder');
|
|
2589
|
-
if (scrollContainer) {
|
|
2590
|
-
setScrollTop(scrollContainer, 900);
|
|
2591
|
-
var scrollEvent = new Event('scroll', {
|
|
2592
|
-
bubbles: true
|
|
2593
|
-
});
|
|
2594
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2595
|
-
jest.advanceTimersByTime(50);
|
|
2596
|
-
setScrollTop(scrollContainer, 100);
|
|
2597
|
-
jest.advanceTimersByTime(100);
|
|
2598
|
-
expect(mockOnPopupScroll).not.toHaveBeenCalled();
|
|
2599
|
-
}
|
|
2600
|
-
}));
|
|
2601
|
-
it('should clear existing scrollLoadingTimeout before setting new one', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2602
|
-
var mockOnPopupScroll = jest.fn();
|
|
2603
|
-
var clearTimeoutSpy = jest.spyOn(global, 'clearTimeout');
|
|
2604
|
-
var user = userEvent.setup({
|
|
2605
|
-
delay: null
|
|
2606
|
-
});
|
|
2607
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2608
|
-
options: options,
|
|
2609
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2610
|
-
customPopupRender: true
|
|
2611
|
-
}));
|
|
2612
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2613
|
-
expect(selector).toBeTruthy();
|
|
2614
|
-
yield user.click(selector);
|
|
2615
|
-
yield waitFor(() => {
|
|
2616
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2617
|
-
});
|
|
2618
|
-
var scrollContainer = setupScrollContainer();
|
|
2619
|
-
jest.advanceTimersByTime(100);
|
|
2620
|
-
if (scrollContainer) {
|
|
2621
|
-
setScrollTop(scrollContainer, 900);
|
|
2622
|
-
var scrollEvent1 = new Event('scroll', {
|
|
2623
|
-
bubbles: true
|
|
2624
|
-
});
|
|
2625
|
-
scrollContainer.dispatchEvent(scrollEvent1);
|
|
2626
|
-
jest.advanceTimersByTime(150);
|
|
2627
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2628
|
-
bubbles: true
|
|
2629
|
-
});
|
|
2630
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2631
|
-
jest.advanceTimersByTime(150);
|
|
2632
|
-
expect(clearTimeoutSpy).toHaveBeenCalled();
|
|
2633
|
-
clearTimeoutSpy.mockRestore();
|
|
2634
|
-
}
|
|
2635
|
-
}));
|
|
2636
|
-
it('should set fallback timeout to clear loading state if options do not change', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2637
|
-
var mockOnPopupScroll = jest.fn();
|
|
2638
|
-
var user = userEvent.setup({
|
|
2639
|
-
delay: null
|
|
2640
|
-
});
|
|
2641
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2642
|
-
options: options,
|
|
2643
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2644
|
-
customPopupRender: true
|
|
2645
|
-
}));
|
|
2646
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2647
|
-
expect(selector).toBeTruthy();
|
|
2648
|
-
yield user.click(selector);
|
|
2649
|
-
yield waitFor(() => {
|
|
2650
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2651
|
-
});
|
|
2652
|
-
var scrollContainer = setupScrollContainer();
|
|
2653
|
-
jest.advanceTimersByTime(100);
|
|
2654
|
-
if (scrollContainer) {
|
|
2655
|
-
setScrollTop(scrollContainer, 900);
|
|
2656
|
-
var scrollEvent = new Event('scroll', {
|
|
2657
|
-
bubbles: true
|
|
2658
|
-
});
|
|
2659
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2660
|
-
jest.advanceTimersByTime(150);
|
|
2661
|
-
yield waitFor(() => {
|
|
2662
|
-
expect(mockOnPopupScroll).toHaveBeenCalled();
|
|
2663
|
-
});
|
|
2664
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
2665
|
-
jest.advanceTimersByTime(10000);
|
|
2666
|
-
}));
|
|
2667
|
-
setScrollTop(scrollContainer, 900);
|
|
2668
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2669
|
-
bubbles: true
|
|
2670
|
-
});
|
|
2671
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2672
|
-
yield act(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
2673
|
-
jest.advanceTimersByTime(150);
|
|
2674
|
-
}));
|
|
2675
|
-
yield waitFor(() => {
|
|
2676
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(2);
|
|
2677
|
-
});
|
|
2678
|
-
}
|
|
2679
|
-
}));
|
|
2680
|
-
it('should store options count and references before calling onPopupScroll', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2681
|
-
var mockOnPopupScroll = jest.fn();
|
|
2682
|
-
var user = userEvent.setup({
|
|
2683
|
-
delay: null
|
|
2684
|
-
});
|
|
2685
|
-
var initialOptions = [{
|
|
2686
|
-
label: 'Option 1',
|
|
2687
|
-
value: '1'
|
|
2688
|
-
}, {
|
|
2689
|
-
label: 'Option 2',
|
|
2690
|
-
value: '2'
|
|
2691
|
-
}];
|
|
2692
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2693
|
-
options: initialOptions,
|
|
2694
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2695
|
-
customPopupRender: true
|
|
2696
|
-
}));
|
|
2697
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2698
|
-
expect(selector).toBeTruthy();
|
|
2699
|
-
yield user.click(selector);
|
|
2700
|
-
yield waitFor(() => {
|
|
2701
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2702
|
-
});
|
|
2703
|
-
var scrollContainer = setupScrollContainer();
|
|
2704
|
-
jest.advanceTimersByTime(100);
|
|
2705
|
-
if (scrollContainer) {
|
|
2706
|
-
setScrollTop(scrollContainer, 900);
|
|
2707
|
-
var scrollEvent = new Event('scroll', {
|
|
2708
|
-
bubbles: true
|
|
2709
|
-
});
|
|
2710
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2711
|
-
jest.advanceTimersByTime(150);
|
|
2712
|
-
yield waitFor(() => {
|
|
2713
|
-
expect(mockOnPopupScroll).toHaveBeenCalled();
|
|
2714
|
-
});
|
|
2715
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2716
|
-
}
|
|
2717
|
-
}));
|
|
2718
|
-
it('should handle rapid scroll events with throttling', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2719
|
-
var mockOnPopupScroll = jest.fn();
|
|
2720
|
-
var user = userEvent.setup({
|
|
2721
|
-
delay: null
|
|
2722
|
-
});
|
|
2723
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2724
|
-
options: options,
|
|
2725
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2726
|
-
customPopupRender: true
|
|
2727
|
-
}));
|
|
2728
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2729
|
-
expect(selector).toBeTruthy();
|
|
2730
|
-
yield user.click(selector);
|
|
2731
|
-
yield waitFor(() => {
|
|
2732
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2733
|
-
});
|
|
2734
|
-
var scrollContainer = setupScrollContainer();
|
|
2735
|
-
jest.advanceTimersByTime(100);
|
|
2736
|
-
if (scrollContainer) {
|
|
2737
|
-
setScrollTop(scrollContainer, 900);
|
|
2738
|
-
for (var i = 0; i < 5; i++) {
|
|
2739
|
-
var scrollEvent = new Event('scroll', {
|
|
2740
|
-
bubbles: true
|
|
2741
|
-
});
|
|
2742
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2743
|
-
jest.advanceTimersByTime(10);
|
|
2744
|
-
}
|
|
2745
|
-
jest.advanceTimersByTime(150);
|
|
2746
|
-
yield waitFor(() => {
|
|
2747
|
-
expect(mockOnPopupScroll).toHaveBeenCalled();
|
|
2748
|
-
});
|
|
2749
|
-
expect(mockOnPopupScroll.mock.calls.length).toBeLessThanOrEqual(2);
|
|
2750
|
-
}
|
|
2751
|
-
}));
|
|
2752
|
-
it('should reset processing flag when scroll moves away from bottom', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2753
|
-
var mockOnPopupScroll = jest.fn();
|
|
2754
|
-
var user = userEvent.setup({
|
|
2755
|
-
delay: null
|
|
2756
|
-
});
|
|
2757
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2758
|
-
options: options,
|
|
2759
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2760
|
-
customPopupRender: true
|
|
2761
|
-
}));
|
|
2762
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2763
|
-
expect(selector).toBeTruthy();
|
|
2764
|
-
yield user.click(selector);
|
|
2765
|
-
yield waitFor(() => {
|
|
2766
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2767
|
-
});
|
|
2768
|
-
var scrollContainer = setupScrollContainer();
|
|
2769
|
-
jest.advanceTimersByTime(100);
|
|
2770
|
-
if (scrollContainer) {
|
|
2771
|
-
setScrollTop(scrollContainer, 900);
|
|
2772
|
-
var scrollEvent1 = new Event('scroll', {
|
|
2773
|
-
bubbles: true
|
|
2774
|
-
});
|
|
2775
|
-
scrollContainer.dispatchEvent(scrollEvent1);
|
|
2776
|
-
jest.advanceTimersByTime(150);
|
|
2777
|
-
yield waitFor(() => {
|
|
2778
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(1);
|
|
2779
|
-
});
|
|
2780
|
-
setScrollTop(scrollContainer, 100);
|
|
2781
|
-
var scrollEvent2 = new Event('scroll', {
|
|
2782
|
-
bubbles: true
|
|
2783
|
-
});
|
|
2784
|
-
scrollContainer.dispatchEvent(scrollEvent2);
|
|
2785
|
-
jest.advanceTimersByTime(150);
|
|
2786
|
-
setScrollTop(scrollContainer, 900);
|
|
2787
|
-
var scrollEvent3 = new Event('scroll', {
|
|
2788
|
-
bubbles: true
|
|
2789
|
-
});
|
|
2790
|
-
scrollContainer.dispatchEvent(scrollEvent3);
|
|
2791
|
-
jest.advanceTimersByTime(150);
|
|
2792
|
-
yield waitFor(() => {
|
|
2793
|
-
expect(mockOnPopupScroll).toHaveBeenCalledTimes(2);
|
|
2794
|
-
});
|
|
2795
|
-
}
|
|
2796
|
-
}));
|
|
2797
|
-
it('should handle edge case where scrollHeight equals scrollTop plus clientHeight exactly', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2798
|
-
var mockOnPopupScroll = jest.fn();
|
|
2799
|
-
var user = userEvent.setup({
|
|
2800
|
-
delay: null
|
|
2801
|
-
});
|
|
2802
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2803
|
-
options: options,
|
|
2804
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2805
|
-
customPopupRender: true
|
|
2806
|
-
}));
|
|
2807
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2808
|
-
expect(selector).toBeTruthy();
|
|
2809
|
-
yield user.click(selector);
|
|
2810
|
-
yield waitFor(() => {
|
|
2811
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2812
|
-
});
|
|
2813
|
-
var scrollContainer = setupScrollContainer();
|
|
2814
|
-
jest.advanceTimersByTime(100);
|
|
2815
|
-
if (scrollContainer) {
|
|
2816
|
-
setScrollTop(scrollContainer, 900);
|
|
2817
|
-
var scrollEvent = new Event('scroll', {
|
|
2818
|
-
bubbles: true
|
|
2819
|
-
});
|
|
2820
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2821
|
-
jest.advanceTimersByTime(150);
|
|
2822
|
-
yield waitFor(() => {
|
|
2823
|
-
expect(mockOnPopupScroll).toHaveBeenCalled();
|
|
2824
|
-
});
|
|
2825
|
-
}
|
|
2826
|
-
}));
|
|
2827
|
-
it('should handle case where scrollHeight - scrollTop is less than clientHeight (definitely near bottom)', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
2828
|
-
var mockOnPopupScroll = jest.fn();
|
|
2829
|
-
var user = userEvent.setup({
|
|
2830
|
-
delay: null
|
|
2831
|
-
});
|
|
2832
|
-
render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2833
|
-
options: options,
|
|
2834
|
-
onPopupScroll: mockOnPopupScroll,
|
|
2835
|
-
customPopupRender: true
|
|
2836
|
-
}));
|
|
2837
|
-
var selector = document.querySelector('.ant-select-content');
|
|
2838
|
-
expect(selector).toBeTruthy();
|
|
2839
|
-
yield user.click(selector);
|
|
2840
|
-
yield waitFor(() => {
|
|
2841
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
2842
|
-
});
|
|
2843
|
-
var scrollContainer = setupScrollContainer();
|
|
2844
|
-
jest.advanceTimersByTime(100);
|
|
2845
|
-
if (scrollContainer) {
|
|
2846
|
-
setScrollTop(scrollContainer, 950);
|
|
2847
|
-
var scrollEvent = new Event('scroll', {
|
|
2848
|
-
bubbles: true
|
|
2849
|
-
});
|
|
2850
|
-
scrollContainer.dispatchEvent(scrollEvent);
|
|
2851
|
-
jest.advanceTimersByTime(150);
|
|
2852
|
-
yield waitFor(() => {
|
|
2853
|
-
expect(mockOnPopupScroll).toHaveBeenCalled();
|
|
2854
|
-
});
|
|
2855
|
-
}
|
|
2856
|
-
}));
|
|
2857
|
-
});
|
|
2858
|
-
});
|
|
2859
|
-
describe('CapUnifiedSelect Snapshots', () => {
|
|
2860
|
-
var simpleOptions = [{
|
|
2861
|
-
value: '1',
|
|
2862
|
-
label: 'Option 1'
|
|
2863
|
-
}, {
|
|
2864
|
-
value: '2',
|
|
2865
|
-
label: 'Option 2'
|
|
2866
|
-
}, {
|
|
2867
|
-
value: '3',
|
|
2868
|
-
label: 'Option 3'
|
|
2869
|
-
}];
|
|
2870
|
-
var treeOptions = [{
|
|
2871
|
-
value: 'parent1',
|
|
2872
|
-
label: 'Parent 1',
|
|
2873
|
-
children: [{
|
|
2874
|
-
value: 'child1',
|
|
2875
|
-
label: 'Child 1'
|
|
2876
|
-
}, {
|
|
2877
|
-
value: 'child2',
|
|
2878
|
-
label: 'Child 2'
|
|
2879
|
-
}]
|
|
2880
|
-
}];
|
|
2881
|
-
it('should match snapshot with default props', () => {
|
|
2882
|
-
var {
|
|
2883
|
-
container
|
|
2884
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2885
|
-
options: simpleOptions,
|
|
2886
|
-
placeholder: "Select an option"
|
|
2887
|
-
}));
|
|
2888
|
-
expect(container).toMatchSnapshot();
|
|
2889
|
-
});
|
|
2890
|
-
it('should match snapshot with selected value', () => {
|
|
2891
|
-
var {
|
|
2892
|
-
container
|
|
2893
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2894
|
-
options: simpleOptions,
|
|
2895
|
-
value: "1"
|
|
2896
|
-
}));
|
|
2897
|
-
expect(container).toMatchSnapshot();
|
|
2898
|
-
});
|
|
2899
|
-
it('should match snapshot with header label', () => {
|
|
2900
|
-
var {
|
|
2901
|
-
container
|
|
2902
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2903
|
-
options: simpleOptions,
|
|
2904
|
-
headerLabel: "Select Header"
|
|
2905
|
-
}));
|
|
2906
|
-
expect(container).toMatchSnapshot();
|
|
2907
|
-
});
|
|
2908
|
-
it('should match snapshot with error state', () => {
|
|
2909
|
-
var {
|
|
2910
|
-
container
|
|
2911
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2912
|
-
options: simpleOptions,
|
|
2913
|
-
isError: true,
|
|
2914
|
-
errorMessage: "This field is required"
|
|
2915
|
-
}));
|
|
2916
|
-
expect(container).toMatchSnapshot();
|
|
2917
|
-
});
|
|
2918
|
-
it('should match snapshot when disabled', () => {
|
|
2919
|
-
var {
|
|
2920
|
-
container
|
|
2921
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2922
|
-
options: simpleOptions,
|
|
2923
|
-
disabled: true,
|
|
2924
|
-
placeholder: "Disabled"
|
|
2925
|
-
}));
|
|
2926
|
-
expect(container).toMatchSnapshot();
|
|
2927
|
-
});
|
|
2928
|
-
it('should match snapshot with multi-select type', () => {
|
|
2929
|
-
var {
|
|
2930
|
-
container
|
|
2931
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2932
|
-
type: SELECT_TYPES.MULTI_SELECT,
|
|
2933
|
-
options: simpleOptions,
|
|
2934
|
-
placeholder: "Select multiple"
|
|
2935
|
-
}));
|
|
2936
|
-
expect(container).toMatchSnapshot();
|
|
2937
|
-
});
|
|
2938
|
-
it('should match snapshot with tree select type', () => {
|
|
2939
|
-
var {
|
|
2940
|
-
container
|
|
2941
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2942
|
-
type: SELECT_TYPES.TREE_SELECT,
|
|
2943
|
-
options: treeOptions,
|
|
2944
|
-
placeholder: "Select from tree"
|
|
2945
|
-
}));
|
|
2946
|
-
expect(container).toMatchSnapshot();
|
|
2947
|
-
});
|
|
2948
|
-
it('should match snapshot with tooltip', () => {
|
|
2949
|
-
var {
|
|
2950
|
-
container
|
|
2951
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2952
|
-
options: simpleOptions,
|
|
2953
|
-
tooltip: "This is a helpful tooltip",
|
|
2954
|
-
headerLabel: "With Tooltip"
|
|
2955
|
-
}));
|
|
2956
|
-
expect(container).toMatchSnapshot();
|
|
2957
|
-
});
|
|
2958
|
-
it('should match snapshot with byline text', () => {
|
|
2959
|
-
var {
|
|
2960
|
-
container
|
|
2961
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2962
|
-
options: simpleOptions,
|
|
2963
|
-
bylineText: "Additional information",
|
|
2964
|
-
headerLabel: "With Byline"
|
|
2965
|
-
}));
|
|
2966
|
-
expect(container).toMatchSnapshot();
|
|
2967
|
-
});
|
|
2968
|
-
it('should match snapshot with custom className', () => {
|
|
2969
|
-
var {
|
|
2970
|
-
container
|
|
2971
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2972
|
-
options: simpleOptions,
|
|
2973
|
-
className: "custom-select",
|
|
2974
|
-
containerClassName: "custom-container"
|
|
2975
|
-
}));
|
|
2976
|
-
expect(container).toMatchSnapshot();
|
|
2977
|
-
});
|
|
2978
|
-
it('should match snapshot in readOnly mode', () => {
|
|
2979
|
-
var {
|
|
2980
|
-
container
|
|
2981
|
-
} = render(/*#__PURE__*/_jsx(CapUnifiedSelect, {
|
|
2982
|
-
options: simpleOptions,
|
|
2983
|
-
value: "1",
|
|
2984
|
-
readOnly: true
|
|
2985
|
-
}));
|
|
2986
|
-
expect(container).toMatchSnapshot();
|
|
2987
|
-
});
|
|
2988
|
-
});
|