intelicoreact 1.5.40 → 1.5.41
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/package.json +1 -1
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.interface.js +0 -4
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.stories.js +0 -89
- package/dist/Atomic/FormElements/ActionAlert/ActionAlert.test.js +0 -130
- package/dist/Atomic/FormElements/ActionAlert/index.js +0 -17
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.interface.js +0 -4
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.stories.js +0 -81
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.test.js +0 -104
- package/dist/Atomic/FormElements/AdvancedStatus/index.js +0 -17
- package/dist/Atomic/FormElements/Calendar/Calendar.props.js +0 -4
- package/dist/Atomic/FormElements/Calendar/Calendar.stories.js +0 -108
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.interface.js +0 -4
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +0 -100
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.test.js +0 -143
- package/dist/Atomic/FormElements/CheckboxInput/index.js +0 -17
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.interface.js +0 -4
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.stories.js +0 -94
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.test.js +0 -177
- package/dist/Atomic/FormElements/CheckboxesLine/index.js +0 -17
- package/dist/Atomic/FormElements/Datepicker/Datepicker.stories.js +0 -51
- package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +0 -596
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.stories.js +0 -272
- package/dist/Atomic/FormElements/FileLoader/FileLoader.stories.js +0 -182
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.stories.js +0 -327
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.stories.js +0 -186
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.stories.js +0 -84
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.stories.js +0 -107
- package/dist/Atomic/FormElements/Input/Input.stories.js +0 -251
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +0 -115
- package/dist/Atomic/FormElements/InputColor/InputColor.stories.js +0 -119
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.interface.js +0 -4
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.stories.js +0 -178
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.test.js +0 -129
- package/dist/Atomic/FormElements/InputCurrency/index.js +0 -16
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +0 -123
- package/dist/Atomic/FormElements/InputLink/InputLink.stories.js +0 -140
- package/dist/Atomic/FormElements/InputMask/InputMask.stories.js +0 -303
- package/dist/Atomic/FormElements/InputMask2/InputMask2.stories.js +0 -314
- package/dist/Atomic/FormElements/InputMask3/InputMask3.stories.js +0 -335
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.stories.js +0 -276
- package/dist/Atomic/FormElements/InputsRow/InputsRow.stories.js +0 -56
- package/dist/Atomic/FormElements/Label/Label.interface.js +0 -4
- package/dist/Atomic/FormElements/Label/Label.stories.js +0 -47
- package/dist/Atomic/FormElements/Label/Label.test.js +0 -167
- package/dist/Atomic/FormElements/Label/index.js +0 -17
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +0 -172
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.stories.js +0 -121
- package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +0 -184
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.stories.js +0 -79
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.stories.js +0 -151
- package/dist/Atomic/FormElements/RadioInput/RadioInput.stories.js +0 -67
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.stories.js +0 -116
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.stories.js +0 -107
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.stories.js +0 -92
- package/dist/Atomic/FormElements/RangeList/RangeList.stories.js +0 -169
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.stories.js +0 -401
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.stories.js +0 -314
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.stories.js +0 -137
- package/dist/Atomic/FormElements/Switcher/Switcher.stories.js +0 -91
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.stories.js +0 -104
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.stories.js +0 -96
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.stories.js +0 -140
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.stories.js +0 -112
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.stories.js +0 -145
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.stories.js +0 -158
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.stories.js +0 -101
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.stories.js +0 -131
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.stories.js +0 -357
- package/dist/Atomic/FormElements/Text/Text.stories.js +0 -80
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.stories.js +0 -106
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.test.js +0 -93
- package/dist/Atomic/FormElements/Textarea/Textarea.stories.js +0 -103
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.stories.js +0 -174
- package/dist/Atomic/FormElements/TimeRange/TimeRange.interface.js +0 -4
- package/dist/Atomic/FormElements/TimeRange/TimeRange.stories.js +0 -40
- package/dist/Atomic/FormElements/TimeRange/TimeRange.test.js +0 -163
- package/dist/Atomic/FormElements/TimeRange/index.js +0 -17
- package/dist/Atomic/FormElements/UserContacts/UserContact.test.js +0 -381
- package/dist/Atomic/FormElements/UserContacts/UserContacts.interface.js +0 -4
- package/dist/Atomic/FormElements/UserContacts/UserContacts.stories.js +0 -74
- package/dist/Atomic/FormElements/UserContacts/index.js +0 -17
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.stories.js +0 -193
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.stories.js +0 -147
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.stories.js +0 -151
- package/dist/Atomic/Layout/Header/Header.stories.js +0 -71
- package/dist/Atomic/Layout/MainMenu/MainMenu.stories.js +0 -115
- package/dist/Atomic/Layout/Spinner/Spinner.interface.js +0 -4
- package/dist/Atomic/Layout/Spinner/Spinner.stories.js +0 -46
- package/dist/Atomic/Layout/Spinner/Spinner.test.js +0 -54
- package/dist/Atomic/Layout/Spinner/index.js +0 -17
- package/dist/Atomic/UI/Accordion/Accordion.interface.js +0 -4
- package/dist/Atomic/UI/Accordion/Accordion.stories.js +0 -168
- package/dist/Atomic/UI/Accordion/Accordion.test.js +0 -54
- package/dist/Atomic/UI/Accordion/AccordionItem.test.js +0 -50
- package/dist/Atomic/UI/Accordion/index.js +0 -17
- package/dist/Atomic/UI/AccordionTable/AccordionTable.stories.js +0 -268
- package/dist/Atomic/UI/AccordionText/AccordionText.stories.js +0 -125
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.stories.js +0 -115
- package/dist/Atomic/UI/Alert/Alert.stories.js +0 -81
- package/dist/Atomic/UI/Arrow/Arrow.stories.js +0 -62
- package/dist/Atomic/UI/Box/Box.stories.js +0 -114
- package/dist/Atomic/UI/Button/Button.stories.js +0 -105
- package/dist/Atomic/UI/Button/Button.test.js +0 -147
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.stories.js +0 -129
- package/dist/Atomic/UI/Chart/Chart.stories.js +0 -93
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.stories.js +0 -85
- package/dist/Atomic/UI/DateTime/DateTime.stories.js +0 -50
- package/dist/Atomic/UI/DoubleString/DoubleString.stories.js +0 -79
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.interface.js +0 -4
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.stories.js +0 -98
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.test.js +0 -51
- package/dist/Atomic/UI/DynamicIcon/index.js +0 -17
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.stories.js +0 -98
- package/dist/Atomic/UI/Hint/Hint.stories.js +0 -101
- package/dist/Atomic/UI/Hint/index.js +0 -16
- package/dist/Atomic/UI/Modal/Modal.interface.js +0 -4
- package/dist/Atomic/UI/Modal/Modal.stories.js +0 -370
- package/dist/Atomic/UI/Modal/ModalHOC.stories.js +0 -191
- package/dist/Atomic/UI/Modal/ModalHOC.test.js +0 -187
- package/dist/Atomic/UI/Modal/index.js +0 -26
- package/dist/Atomic/UI/Modal/partials/ModalFooter.test.js +0 -118
- package/dist/Atomic/UI/Modal/partials/ModalTitle.test.js +0 -126
- package/dist/Atomic/UI/Modal/partials/useMobileModal.test.js +0 -133
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.interface.js +0 -4
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.stories.js +0 -513
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.test.js +0 -84
- package/dist/Atomic/UI/MonoAccordion/index.js +0 -17
- package/dist/Atomic/UI/NavLine/NavLine.interface.js +0 -4
- package/dist/Atomic/UI/NavLine/NavLine.stories.js +0 -434
- package/dist/Atomic/UI/NavLine/NavLine.test.js +0 -311
- package/dist/Atomic/UI/NavLine/index.js +0 -17
- package/dist/Atomic/UI/PageTitle/PageTitle.interface.js +0 -4
- package/dist/Atomic/UI/PageTitle/PageTitle.stories.js +0 -62
- package/dist/Atomic/UI/PageTitle/PageTitle.test.js +0 -181
- package/dist/Atomic/UI/PageTitle/index.js +0 -17
- package/dist/Atomic/UI/PieChart/PieChar.interface.js +0 -4
- package/dist/Atomic/UI/PieChart/PieChart.stories.js +0 -82
- package/dist/Atomic/UI/PieChart/PieChart.test.js +0 -142
- package/dist/Atomic/UI/PieChart/index.js +0 -26
- package/dist/Atomic/UI/Price/Price.interface.js +0 -4
- package/dist/Atomic/UI/Price/Price.stories.js +0 -52
- package/dist/Atomic/UI/Price/Price.test.js +0 -83
- package/dist/Atomic/UI/Price/index.js +0 -17
- package/dist/Atomic/UI/PriceRange/PriceRange.interface.js +0 -4
- package/dist/Atomic/UI/PriceRange/PriceRange.stories.js +0 -51
- package/dist/Atomic/UI/PriceRange/PriceRange.test.js +0 -72
- package/dist/Atomic/UI/PriceRange/index.js +0 -17
- package/dist/Atomic/UI/ProgressLine/ProgressLine.interface.js +0 -4
- package/dist/Atomic/UI/ProgressLine/ProgressLine.stories.js +0 -163
- package/dist/Atomic/UI/ProgressLine/ProgressLine.test.js +0 -60
- package/dist/Atomic/UI/ProgressLine/index.js +0 -17
- package/dist/Atomic/UI/Status/Status.interface.js +0 -4
- package/dist/Atomic/UI/Status/Status.stories.js +0 -79
- package/dist/Atomic/UI/Status/Status.test.js +0 -103
- package/dist/Atomic/UI/Status/index.js +0 -17
- package/dist/Atomic/UI/Table/Table.stories.js +0 -250
- package/dist/Atomic/UI/Tag/Tag.interface.js +0 -4
- package/dist/Atomic/UI/Tag/Tag.stories.js +0 -108
- package/dist/Atomic/UI/Tag/Tag.test.js +0 -75
- package/dist/Atomic/UI/Tag/index.js +0 -17
- package/dist/Atomic/UI/TagList/TagList.stories.js +0 -169
- package/dist/Atomic/UI/UserBox/UserBox.interface.js +0 -4
- package/dist/Atomic/UI/UserBox/UserBox.stories.js +0 -57
- package/dist/Atomic/UI/UserBox/UserBox.test.js +0 -136
- package/dist/Atomic/UI/UserBox/index.js +0 -17
- package/dist/Atomic/UI/WizardStepper/WizardStepper.stories.js +0 -70
- package/dist/Functions/useIsMobile/index.js +0 -17
- package/dist/Functions/useIsMobile/useIsMobile.js +0 -33
- package/dist/Functions/useIsMobile/useIsMobile.test.js +0 -104
- package/dist/Functions/useKeyPress/useHandleKeyPress.test.js +0 -96
- package/dist/Functions/useKeyPress/useKeyPress.test.js +0 -87
- package/dist/Molecular/FormElement/FormElement.stories.js +0 -92
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.stories.js +0 -301
- package/dist/Molecular/InputAddress/InputAddress.stories.js +0 -541
- package/dist/Molecular/InputPassword/InputPassword.stories.js +0 -86
- package/dist/types/base.interface.js +0 -4
- package/dist/types/base.types.js +0 -4
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
function _export(target, all) {
|
|
7
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: all[name]
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
Default: function() {
|
|
14
|
-
return Default;
|
|
15
|
-
},
|
|
16
|
-
EmptyContent: function() {
|
|
17
|
-
return EmptyContent;
|
|
18
|
-
},
|
|
19
|
-
LargeModal: function() {
|
|
20
|
-
return LargeModal;
|
|
21
|
-
},
|
|
22
|
-
NoEscapeKey: function() {
|
|
23
|
-
return NoEscapeKey;
|
|
24
|
-
},
|
|
25
|
-
SmallModal: function() {
|
|
26
|
-
return SmallModal;
|
|
27
|
-
},
|
|
28
|
-
default: function() {
|
|
29
|
-
return _default;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
33
|
-
const _react = require("react");
|
|
34
|
-
const _Dropdown = /*#__PURE__*/ _interop_require_default(require("../../FormElements/Dropdown/Dropdown"));
|
|
35
|
-
const _Alert = /*#__PURE__*/ _interop_require_default(require("../Alert/Alert"));
|
|
36
|
-
const _Button = /*#__PURE__*/ _interop_require_default(require("../Button/Button"));
|
|
37
|
-
const _Hint = /*#__PURE__*/ _interop_require_default(require("../Hint/Hint"));
|
|
38
|
-
const _ModalHOC = /*#__PURE__*/ _interop_require_default(require("./ModalHOC"));
|
|
39
|
-
require("../../../../../scss/main.scss");
|
|
40
|
-
function _interop_require_default(obj) {
|
|
41
|
-
return obj && obj.__esModule ? obj : {
|
|
42
|
-
default: obj
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const meta = {
|
|
46
|
-
title: 'UI/Modal/ModalHOC',
|
|
47
|
-
component: _ModalHOC.default,
|
|
48
|
-
parameters: {
|
|
49
|
-
layout: 'centered',
|
|
50
|
-
docs: {
|
|
51
|
-
description: {
|
|
52
|
-
component: 'Modal component with customizable header, body, and footer sections'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
argTypes: {
|
|
57
|
-
size: {
|
|
58
|
-
description: 'Modal size in pixels or "default"',
|
|
59
|
-
control: {
|
|
60
|
-
type: 'select',
|
|
61
|
-
options: [
|
|
62
|
-
'default',
|
|
63
|
-
290,
|
|
64
|
-
420,
|
|
65
|
-
870,
|
|
66
|
-
770,
|
|
67
|
-
950
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
table: {
|
|
71
|
-
category: 'Appearance'
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
closeOnEsc: {
|
|
75
|
-
description: 'Enable closing modal with Escape key',
|
|
76
|
-
control: 'boolean',
|
|
77
|
-
table: {
|
|
78
|
-
category: 'Behavior',
|
|
79
|
-
defaultValue: {
|
|
80
|
-
summary: ''
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
isOpen: {
|
|
85
|
-
description: 'Controls modal visibility',
|
|
86
|
-
control: 'boolean',
|
|
87
|
-
table: {
|
|
88
|
-
category: 'Behavior'
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
// Content
|
|
92
|
-
children: {
|
|
93
|
-
description: 'Modal content',
|
|
94
|
-
control: 'text',
|
|
95
|
-
table: {
|
|
96
|
-
category: 'Content'
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
zIndex: {
|
|
100
|
-
description: 'Modal stack order',
|
|
101
|
-
control: 'number',
|
|
102
|
-
table: {
|
|
103
|
-
category: 'Layout',
|
|
104
|
-
defaultValue: {
|
|
105
|
-
summary: '100'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const _default = meta;
|
|
112
|
-
const Template = ({ isShowEmptyContent = false, ...args })=>{
|
|
113
|
-
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
114
|
-
const closeModal = ()=>setIsOpen(false);
|
|
115
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
116
|
-
children: [
|
|
117
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
|
|
118
|
-
onClick: ()=>setIsOpen(true),
|
|
119
|
-
label: "Show modal",
|
|
120
|
-
variant: "primary"
|
|
121
|
-
}),
|
|
122
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
123
|
-
...args,
|
|
124
|
-
isOpen: isOpen,
|
|
125
|
-
closeModal: closeModal,
|
|
126
|
-
children: !isShowEmptyContent && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
127
|
-
className: "modal__body",
|
|
128
|
-
children: [
|
|
129
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("h2", {
|
|
130
|
-
children: "Modal Content"
|
|
131
|
-
}),
|
|
132
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Alert.default, {
|
|
133
|
-
message: "Info alert",
|
|
134
|
-
variant: "info",
|
|
135
|
-
className: "mb5"
|
|
136
|
-
}),
|
|
137
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Dropdown.default, {
|
|
138
|
-
entity: "example",
|
|
139
|
-
value: "option1",
|
|
140
|
-
placeholder: "Select an option",
|
|
141
|
-
options: [
|
|
142
|
-
{
|
|
143
|
-
label: 'Option 1',
|
|
144
|
-
value: 'option1'
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
label: 'Option 2',
|
|
148
|
-
value: 'option2'
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
label: 'Option 3',
|
|
152
|
-
value: 'option3'
|
|
153
|
-
}
|
|
154
|
-
],
|
|
155
|
-
className: "mb5"
|
|
156
|
-
}),
|
|
157
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Hint.default, {
|
|
158
|
-
hint: "This is a helpful hint",
|
|
159
|
-
side: "right",
|
|
160
|
-
className: "mb5"
|
|
161
|
-
})
|
|
162
|
-
]
|
|
163
|
-
})
|
|
164
|
-
})
|
|
165
|
-
]
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
const Default = Template.bind({});
|
|
169
|
-
Default.args = {
|
|
170
|
-
submitHandler: ()=>console.log('Submit clicked')
|
|
171
|
-
};
|
|
172
|
-
const SmallModal = Template.bind({});
|
|
173
|
-
SmallModal.args = {
|
|
174
|
-
...Default.args,
|
|
175
|
-
size: 290
|
|
176
|
-
};
|
|
177
|
-
const LargeModal = Template.bind({});
|
|
178
|
-
LargeModal.args = {
|
|
179
|
-
...Default.args,
|
|
180
|
-
size: 950
|
|
181
|
-
};
|
|
182
|
-
const EmptyContent = Template.bind({});
|
|
183
|
-
EmptyContent.args = {
|
|
184
|
-
...Default.args,
|
|
185
|
-
isShowEmptyContent: true
|
|
186
|
-
};
|
|
187
|
-
const NoEscapeKey = Template.bind({});
|
|
188
|
-
NoEscapeKey.args = {
|
|
189
|
-
...Default.args,
|
|
190
|
-
closeOnEsc: false
|
|
191
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
6
|
-
const _react = require("@testing-library/react");
|
|
7
|
-
const _userevent = /*#__PURE__*/ _interop_require_default(require("@testing-library/user-event"));
|
|
8
|
-
const _ModalHOC = /*#__PURE__*/ _interop_require_default(require("./ModalHOC"));
|
|
9
|
-
function _interop_require_default(obj) {
|
|
10
|
-
return obj && obj.__esModule ? obj : {
|
|
11
|
-
default: obj
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const defaultProps = {
|
|
15
|
-
isOpen: true,
|
|
16
|
-
closeModal: jest.fn(),
|
|
17
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
18
|
-
children: "Modal Content"
|
|
19
|
-
})
|
|
20
|
-
};
|
|
21
|
-
describe('modal', ()=>{
|
|
22
|
-
beforeEach(()=>{
|
|
23
|
-
jest.clearAllMocks();
|
|
24
|
-
});
|
|
25
|
-
describe('rendering', ()=>{
|
|
26
|
-
it('should not render when isOpen is false', ()=>{
|
|
27
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
28
|
-
...defaultProps,
|
|
29
|
-
isOpen: false
|
|
30
|
-
}));
|
|
31
|
-
expect(_react.screen.queryByTestId('modal')).not.toBeInTheDocument();
|
|
32
|
-
});
|
|
33
|
-
it('should render with default testId', ()=>{
|
|
34
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
35
|
-
...defaultProps
|
|
36
|
-
}));
|
|
37
|
-
expect(_react.screen.getByTestId('modal')).toBeInTheDocument();
|
|
38
|
-
});
|
|
39
|
-
it('should render with custom testId', ()=>{
|
|
40
|
-
const customTestId = 'custom-modal';
|
|
41
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
42
|
-
...defaultProps,
|
|
43
|
-
testId: customTestId
|
|
44
|
-
}));
|
|
45
|
-
expect(_react.screen.getByTestId(customTestId)).toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
it('should render children correctly', ()=>{
|
|
48
|
-
const childText = 'Test Content';
|
|
49
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
50
|
-
...defaultProps,
|
|
51
|
-
children: childText
|
|
52
|
-
}));
|
|
53
|
-
expect(_react.screen.getByText(childText)).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
it('should apply custom className to modal', ()=>{
|
|
56
|
-
const customClass = 'custom-modal';
|
|
57
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
58
|
-
...defaultProps,
|
|
59
|
-
className: customClass
|
|
60
|
-
}));
|
|
61
|
-
const modalElement = _react.screen.getByRole('dialog');
|
|
62
|
-
expect(modalElement).toHaveClass(customClass, 'modal');
|
|
63
|
-
});
|
|
64
|
-
it('should apply custom size', ()=>{
|
|
65
|
-
const size = '500px';
|
|
66
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
67
|
-
...defaultProps,
|
|
68
|
-
size: size
|
|
69
|
-
}));
|
|
70
|
-
const modalElement = _react.screen.getByRole('dialog');
|
|
71
|
-
expect(modalElement).toHaveStyle({
|
|
72
|
-
width: size
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
it('should apply custom zIndex', ()=>{
|
|
76
|
-
const zIndex = 200;
|
|
77
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
78
|
-
...defaultProps,
|
|
79
|
-
zIndex: zIndex
|
|
80
|
-
}));
|
|
81
|
-
const modalBox = _react.screen.getByTestId('modal');
|
|
82
|
-
expect(modalBox).toHaveStyle({
|
|
83
|
-
zIndex
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
describe('accessibility', ()=>{
|
|
88
|
-
it('should have correct ARIA attributes', ()=>{
|
|
89
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
90
|
-
...defaultProps
|
|
91
|
-
}));
|
|
92
|
-
const dialog = _react.screen.getByRole('dialog');
|
|
93
|
-
expect(dialog).toHaveAttribute('aria-modal', 'true');
|
|
94
|
-
expect(dialog).toHaveAttribute('aria-labelledby', 'modal');
|
|
95
|
-
expect(dialog).toHaveAttribute('tabIndex', '-1');
|
|
96
|
-
});
|
|
97
|
-
it('should have correct structure with presentation roles', ()=>{
|
|
98
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
99
|
-
...defaultProps
|
|
100
|
-
}));
|
|
101
|
-
const modalBox = _react.screen.getByTestId('modal');
|
|
102
|
-
expect(modalBox).toHaveAttribute('role', 'presentation');
|
|
103
|
-
expect(modalBox).toHaveClass('modal-box');
|
|
104
|
-
const overlay = modalBox.querySelector('.modal-overlay');
|
|
105
|
-
expect(overlay).toHaveAttribute('role', 'presentation');
|
|
106
|
-
expect(overlay).toHaveAttribute('aria-hidden', 'true');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
describe('interactions', ()=>{
|
|
110
|
-
it('should call closeModal when overlay is clicked', async ()=>{
|
|
111
|
-
const closeModal = jest.fn();
|
|
112
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
113
|
-
...defaultProps,
|
|
114
|
-
closeModal: closeModal
|
|
115
|
-
}));
|
|
116
|
-
const overlay = _react.screen.getByTestId('modal').querySelector('.modal-overlay');
|
|
117
|
-
await _userevent.default.click(overlay);
|
|
118
|
-
expect(closeModal).toHaveBeenCalledTimes(1);
|
|
119
|
-
});
|
|
120
|
-
it('should call closeModal on Escape key when closeOnEsc is true', ()=>{
|
|
121
|
-
const closeModal = jest.fn();
|
|
122
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
123
|
-
...defaultProps,
|
|
124
|
-
closeModal: closeModal,
|
|
125
|
-
closeOnEsc: true
|
|
126
|
-
}));
|
|
127
|
-
_react.fireEvent.keyDown(document, {
|
|
128
|
-
key: 'Escape',
|
|
129
|
-
code: 'Escape'
|
|
130
|
-
});
|
|
131
|
-
expect(closeModal).toHaveBeenCalledTimes(1);
|
|
132
|
-
});
|
|
133
|
-
it('should not call closeModal on Escape key when closeOnEsc is false', ()=>{
|
|
134
|
-
const closeModal = jest.fn();
|
|
135
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
136
|
-
...defaultProps,
|
|
137
|
-
closeModal: closeModal,
|
|
138
|
-
closeOnEsc: false
|
|
139
|
-
}));
|
|
140
|
-
_react.fireEvent.keyDown(document, {
|
|
141
|
-
key: 'Escape',
|
|
142
|
-
code: 'Escape'
|
|
143
|
-
});
|
|
144
|
-
expect(closeModal).not.toHaveBeenCalled();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
describe('edge cases', ()=>{
|
|
148
|
-
it('should handle undefined closeModal', ()=>{
|
|
149
|
-
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(()=>{});
|
|
150
|
-
// @ts-ignore
|
|
151
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
152
|
-
...defaultProps,
|
|
153
|
-
closeModal: undefined
|
|
154
|
-
}));
|
|
155
|
-
_react.fireEvent.keyDown(document, {
|
|
156
|
-
key: 'Escape'
|
|
157
|
-
});
|
|
158
|
-
expect(consoleSpy).not.toHaveBeenCalled();
|
|
159
|
-
consoleSpy.mockRestore();
|
|
160
|
-
});
|
|
161
|
-
it('should handle null children', ()=>{
|
|
162
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
163
|
-
...defaultProps,
|
|
164
|
-
children: null
|
|
165
|
-
}));
|
|
166
|
-
const dialog = _react.screen.getByRole('dialog');
|
|
167
|
-
expect(dialog).toBeEmptyDOMElement();
|
|
168
|
-
});
|
|
169
|
-
it('should handle empty children', ()=>{
|
|
170
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
171
|
-
...defaultProps,
|
|
172
|
-
children: undefined
|
|
173
|
-
}));
|
|
174
|
-
const dialog = _react.screen.getByRole('dialog');
|
|
175
|
-
expect(dialog).toBeEmptyDOMElement();
|
|
176
|
-
});
|
|
177
|
-
it('should use default zIndex when not provided', ()=>{
|
|
178
|
-
(0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalHOC.default, {
|
|
179
|
-
...defaultProps
|
|
180
|
-
}));
|
|
181
|
-
const modalBox = _react.screen.getByTestId('modal');
|
|
182
|
-
expect(modalBox).toHaveStyle({
|
|
183
|
-
zIndex: 100
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
ModalHOC: function() {
|
|
13
|
-
return _ModalHOC.default;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _Modal = /*#__PURE__*/ _interop_require_default(require("./Modal"));
|
|
20
|
-
const _ModalHOC = /*#__PURE__*/ _interop_require_default(require("./ModalHOC"));
|
|
21
|
-
function _interop_require_default(obj) {
|
|
22
|
-
return obj && obj.__esModule ? obj : {
|
|
23
|
-
default: obj
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const _default = _Modal.default;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
6
|
-
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
7
|
-
const _react1 = require("@testing-library/react");
|
|
8
|
-
const _ModalFooter = /*#__PURE__*/ _interop_require_default(require("./ModalFooter"));
|
|
9
|
-
function _interop_require_default(obj) {
|
|
10
|
-
return obj && obj.__esModule ? obj : {
|
|
11
|
-
default: obj
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
describe('modalFooter', ()=>{
|
|
15
|
-
const defaultProps = {
|
|
16
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
17
|
-
children: "Test Content"
|
|
18
|
-
}),
|
|
19
|
-
testId: 'test-footer'
|
|
20
|
-
};
|
|
21
|
-
it('renders correctly with default props', ()=>{
|
|
22
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
23
|
-
...defaultProps
|
|
24
|
-
}));
|
|
25
|
-
const footer = _react1.screen.getByTestId('test-footer');
|
|
26
|
-
expect(footer).toBeInTheDocument();
|
|
27
|
-
expect(footer).toHaveClass('modal__footer');
|
|
28
|
-
});
|
|
29
|
-
it('renders children correctly', ()=>{
|
|
30
|
-
const testContent = 'Test Footer Content';
|
|
31
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
32
|
-
...defaultProps,
|
|
33
|
-
children: testContent
|
|
34
|
-
}));
|
|
35
|
-
expect(_react1.screen.getByText(testContent)).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
it('applies custom className', ()=>{
|
|
38
|
-
const customClass = 'custom-class';
|
|
39
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
40
|
-
...defaultProps,
|
|
41
|
-
className: customClass
|
|
42
|
-
}));
|
|
43
|
-
const footer = _react1.screen.getByTestId('test-footer');
|
|
44
|
-
expect(footer).toHaveClass('modal__footer', customClass);
|
|
45
|
-
});
|
|
46
|
-
it('uses wrapperRef correctly', ()=>{
|
|
47
|
-
var _ref_current;
|
|
48
|
-
const ref = /*#__PURE__*/ _react.default.createRef();
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
51
|
-
...defaultProps,
|
|
52
|
-
wrapperRef: ref
|
|
53
|
-
}));
|
|
54
|
-
expect(ref.current).toBeInstanceOf(HTMLElement);
|
|
55
|
-
expect((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.tagName).toBe('FOOTER');
|
|
56
|
-
});
|
|
57
|
-
describe('accessibility', ()=>{
|
|
58
|
-
it('has correct ARIA attributes', ()=>{
|
|
59
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
60
|
-
...defaultProps
|
|
61
|
-
}));
|
|
62
|
-
const footer = _react1.screen.getByRole('contentinfo');
|
|
63
|
-
expect(footer).toHaveAttribute('aria-label', 'Modal footer');
|
|
64
|
-
});
|
|
65
|
-
it('has correct semantic HTML structure', ()=>{
|
|
66
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
67
|
-
...defaultProps
|
|
68
|
-
}));
|
|
69
|
-
expect(_react1.screen.getByRole('contentinfo')).toBeInTheDocument();
|
|
70
|
-
});
|
|
71
|
-
it('maintains content structure', ()=>{
|
|
72
|
-
const complexContent = /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
73
|
-
role: "group",
|
|
74
|
-
"aria-label": "Footer actions",
|
|
75
|
-
children: [
|
|
76
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("button", {
|
|
77
|
-
children: "Cancel"
|
|
78
|
-
}),
|
|
79
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("button", {
|
|
80
|
-
children: "Confirm"
|
|
81
|
-
})
|
|
82
|
-
]
|
|
83
|
-
});
|
|
84
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
85
|
-
children: complexContent
|
|
86
|
-
}));
|
|
87
|
-
const group = _react1.screen.getByRole('group');
|
|
88
|
-
expect(group).toHaveAttribute('aria-label', 'Footer actions');
|
|
89
|
-
expect(_react1.screen.getAllByRole('button')).toHaveLength(2);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
describe('memoization', ()=>{
|
|
93
|
-
it('should not re-render with same props', ()=>{
|
|
94
|
-
const { rerender } = (0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
95
|
-
...defaultProps
|
|
96
|
-
}));
|
|
97
|
-
const firstRender = _react1.screen.getByTestId('test-footer');
|
|
98
|
-
rerender(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
99
|
-
...defaultProps
|
|
100
|
-
}));
|
|
101
|
-
const secondRender = _react1.screen.getByTestId('test-footer');
|
|
102
|
-
expect(firstRender).toBe(secondRender);
|
|
103
|
-
});
|
|
104
|
-
it('should re-render with different props', ()=>{
|
|
105
|
-
const { rerender } = (0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
106
|
-
...defaultProps,
|
|
107
|
-
className: "initial"
|
|
108
|
-
}));
|
|
109
|
-
const initialClassName = _react1.screen.getByTestId('test-footer').className;
|
|
110
|
-
rerender(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalFooter.default, {
|
|
111
|
-
...defaultProps,
|
|
112
|
-
className: "updated"
|
|
113
|
-
}));
|
|
114
|
-
const updatedClassName = _react1.screen.getByTestId('test-footer').className;
|
|
115
|
-
expect(initialClassName).not.toBe(updatedClassName);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
6
|
-
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
7
|
-
const _react1 = require("@testing-library/react");
|
|
8
|
-
const _userevent = /*#__PURE__*/ _interop_require_default(require("@testing-library/user-event"));
|
|
9
|
-
const _ModalTitle = /*#__PURE__*/ _interop_require_default(require("./ModalTitle"));
|
|
10
|
-
function _interop_require_default(obj) {
|
|
11
|
-
return obj && obj.__esModule ? obj : {
|
|
12
|
-
default: obj
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
describe('modalTitle', ()=>{
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
children: 'Test Title',
|
|
18
|
-
onClose: jest.fn(),
|
|
19
|
-
testId: 'test-modal'
|
|
20
|
-
};
|
|
21
|
-
beforeEach(()=>{
|
|
22
|
-
jest.clearAllMocks();
|
|
23
|
-
});
|
|
24
|
-
it('renders correctly with default props', ()=>{
|
|
25
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
26
|
-
...defaultProps
|
|
27
|
-
}));
|
|
28
|
-
const header = _react1.screen.getByRole('banner');
|
|
29
|
-
const closeButton = _react1.screen.getByRole('button');
|
|
30
|
-
expect(header).toHaveClass('modal__header', 'modal__header-primary');
|
|
31
|
-
expect(closeButton).toBeInTheDocument();
|
|
32
|
-
});
|
|
33
|
-
it('applies custom className', ()=>{
|
|
34
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
35
|
-
...defaultProps,
|
|
36
|
-
className: "custom-class"
|
|
37
|
-
}));
|
|
38
|
-
expect(_react1.screen.getByRole('banner')).toHaveClass('custom-class');
|
|
39
|
-
});
|
|
40
|
-
it('handles different variants', ()=>{
|
|
41
|
-
const { rerender } = (0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
42
|
-
...defaultProps,
|
|
43
|
-
variant: "default"
|
|
44
|
-
}));
|
|
45
|
-
rerender(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
46
|
-
...defaultProps,
|
|
47
|
-
variant: "default"
|
|
48
|
-
}));
|
|
49
|
-
expect(_react1.screen.getByRole('banner')).toHaveClass('modal__header-default');
|
|
50
|
-
});
|
|
51
|
-
describe('close button', ()=>{
|
|
52
|
-
it('calls onClose when clicked', async ()=>{
|
|
53
|
-
const onClose = jest.fn();
|
|
54
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
55
|
-
...defaultProps,
|
|
56
|
-
onClose: onClose
|
|
57
|
-
}));
|
|
58
|
-
await _userevent.default.click(_react1.screen.getByRole('button'));
|
|
59
|
-
expect(onClose).toHaveBeenCalledTimes(1);
|
|
60
|
-
});
|
|
61
|
-
it('handles keyboard events correctly', ()=>{
|
|
62
|
-
const onClose = jest.fn();
|
|
63
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
64
|
-
...defaultProps,
|
|
65
|
-
onClose: onClose
|
|
66
|
-
}));
|
|
67
|
-
const button = _react1.screen.getByRole('button');
|
|
68
|
-
// Проверяем нажатие Enter
|
|
69
|
-
_react1.fireEvent.keyDown(button, {
|
|
70
|
-
key: 'Enter'
|
|
71
|
-
});
|
|
72
|
-
expect(onClose).toHaveBeenCalledTimes(1);
|
|
73
|
-
// Сбрасываем моковую функцию
|
|
74
|
-
onClose.mockClear();
|
|
75
|
-
// Проверяем нажатие Space
|
|
76
|
-
_react1.fireEvent.keyDown(button, {
|
|
77
|
-
key: 'Space'
|
|
78
|
-
});
|
|
79
|
-
expect(onClose).toHaveBeenCalledTimes(1);
|
|
80
|
-
});
|
|
81
|
-
it('is not rendered when isForced is true', ()=>{
|
|
82
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
83
|
-
...defaultProps,
|
|
84
|
-
isForced: true
|
|
85
|
-
}));
|
|
86
|
-
expect(_react1.screen.queryByRole('button')).not.toBeInTheDocument();
|
|
87
|
-
});
|
|
88
|
-
it('renders without icon when noHeaderCloseBtn is true', ()=>{
|
|
89
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
90
|
-
...defaultProps,
|
|
91
|
-
noHeaderCloseBtn: true
|
|
92
|
-
}));
|
|
93
|
-
const button = _react1.screen.getByRole('button');
|
|
94
|
-
expect(button).toBeInTheDocument();
|
|
95
|
-
expect(button.querySelector('.modal-close-icon')).not.toBeInTheDocument();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe('accessibility', ()=>{
|
|
99
|
-
it('has correct ARIA attributes', ()=>{
|
|
100
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
101
|
-
...defaultProps
|
|
102
|
-
}));
|
|
103
|
-
const header = _react1.screen.getByRole('banner');
|
|
104
|
-
const closeButton = _react1.screen.getByRole('button');
|
|
105
|
-
expect(header).toHaveAttribute('aria-label', 'Modal header');
|
|
106
|
-
expect(closeButton).toHaveAttribute('aria-label', 'Close modal');
|
|
107
|
-
});
|
|
108
|
-
it('makes close icon decorative', ()=>{
|
|
109
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
110
|
-
...defaultProps
|
|
111
|
-
}));
|
|
112
|
-
const icon = _react1.screen.getByRole('img', {
|
|
113
|
-
hidden: true
|
|
114
|
-
});
|
|
115
|
-
expect(icon).toHaveAttribute('aria-hidden', 'true');
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
it('uses wrapperRef correctly', ()=>{
|
|
119
|
-
const ref = /*#__PURE__*/ _react.default.createRef();
|
|
120
|
-
(0, _react1.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_ModalTitle.default, {
|
|
121
|
-
...defaultProps,
|
|
122
|
-
wrapperRef: ref
|
|
123
|
-
}));
|
|
124
|
-
expect(ref.current).toBeInstanceOf(HTMLElement);
|
|
125
|
-
});
|
|
126
|
-
});
|