@qoretechnologies/reqore 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +6 -2
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +29 -0
- package/dist/components/DatePicker/index.d.ts.map +1 -0
- package/dist/components/DatePicker/index.js +147 -0
- package/dist/components/DatePicker/index.js.map +1 -0
- package/dist/components/Effect/index.d.ts +1 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +3 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +5 -1
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts +2 -0
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +5 -4
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/tests.json +1 -1
- package/.eslintrc.js +0 -40
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
- package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
- package/.github/workflows/beta_release.yml +0 -100
- package/.github/workflows/tests.yml +0 -84
- package/.gitpod.yml +0 -11
- package/.jest-test-results.json +0 -1
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -0
- package/__tests__/breadcrumbs.test.tsx +0 -75
- package/__tests__/button.test.tsx +0 -218
- package/__tests__/checkbox.test.tsx +0 -45
- package/__tests__/collection.test.tsx +0 -243
- package/__tests__/containers/paging.test.tsx +0 -138
- package/__tests__/control_group.test.tsx +0 -32
- package/__tests__/drawer.test.tsx +0 -140
- package/__tests__/dropdown.test.tsx +0 -381
- package/__tests__/effect.test.tsx +0 -70
- package/__tests__/heading.test.tsx +0 -58
- package/__tests__/helpers/colors.test.tsx +0 -18
- package/__tests__/helpers/table.test.tsx +0 -67
- package/__tests__/hooks/useLatestZIndex.test.tsx +0 -10
- package/__tests__/hooks/useReqorePaging.test.tsx +0 -271
- package/__tests__/hooks/useTheme.test.tsx +0 -31
- package/__tests__/icon.test.tsx +0 -53
- package/__tests__/input.test.tsx +0 -482
- package/__tests__/layout.test.tsx +0 -37
- package/__tests__/menu.test.tsx +0 -65
- package/__tests__/messages.test.tsx +0 -79
- package/__tests__/modal.test.tsx +0 -204
- package/__tests__/multiselect.test.tsx +0 -458
- package/__tests__/navbar.test.tsx +0 -31
- package/__tests__/notifications.test.tsx +0 -178
- package/__tests__/pagination.test.tsx +0 -437
- package/__tests__/panel.test.tsx +0 -243
- package/__tests__/popover.test.tsx +0 -282
- package/__tests__/radiogroup.test.tsx +0 -47
- package/__tests__/setup.js +0 -8
- package/__tests__/stories/Collection.stories.tsx +0 -0
- package/__tests__/table.test.tsx +0 -647
- package/__tests__/tabs.test.tsx +0 -321
- package/__tests__/tag.test.tsx +0 -160
- package/__tests__/textarea.test.tsx +0 -467
- package/__tests__/timeAgo.test.tsx +0 -27
- package/__tests__/tree.test.tsx +0 -58
- package/build-storybook.log +0 -491
- package/chromatic.config.json +0 -1
- package/icons.ts +0 -1
- package/migration-storybook.log +0 -56
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol-small.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Breadcrumbs/index.tsx +0 -254
- package/src/components/Breadcrumbs/item.tsx +0 -44
- package/src/components/Button/index.tsx +0 -628
- package/src/components/Checkbox/index.tsx +0 -388
- package/src/components/Collection/index.tsx +0 -426
- package/src/components/Collection/item.tsx +0 -267
- package/src/components/Columns/column.tsx +0 -27
- package/src/components/Columns/index.tsx +0 -41
- package/src/components/Comment/index.tsx +0 -141
- package/src/components/CommentFeed/index.tsx +0 -34
- package/src/components/Content/index.tsx +0 -34
- package/src/components/Content/wrapper.tsx +0 -36
- package/src/components/ControlGroup/index.tsx +0 -523
- package/src/components/Drawer/backdrop.tsx +0 -54
- package/src/components/Drawer/index.tsx +0 -365
- package/src/components/Dropdown/index.tsx +0 -153
- package/src/components/Dropdown/item.tsx +0 -33
- package/src/components/Dropdown/list.tsx +0 -222
- package/src/components/Effect/index.tsx +0 -463
- package/src/components/ExportModal/index.tsx +0 -99
- package/src/components/Header/index.tsx +0 -81
- package/src/components/Icon/index.tsx +0 -184
- package/src/components/Input/index.tsx +0 -282
- package/src/components/InputClearButton/index.tsx +0 -59
- package/src/components/InternalPopover/index.tsx +0 -303
- package/src/components/KeyValueTable/index.tsx +0 -192
- package/src/components/Label/index.tsx +0 -10
- package/src/components/Layout/content.tsx +0 -31
- package/src/components/Layout/index.tsx +0 -55
- package/src/components/Menu/divider.tsx +0 -92
- package/src/components/Menu/index.tsx +0 -141
- package/src/components/Menu/item.tsx +0 -137
- package/src/components/Menu/section.tsx +0 -81
- package/src/components/Message/index.tsx +0 -220
- package/src/components/Modal/index.tsx +0 -26
- package/src/components/MultiSelect/index.tsx +0 -288
- package/src/components/Navbar/divider.tsx +0 -50
- package/src/components/Navbar/group.tsx +0 -53
- package/src/components/Navbar/index.tsx +0 -82
- package/src/components/Navbar/item.tsx +0 -92
- package/src/components/Notifications/index.tsx +0 -57
- package/src/components/Notifications/notification.tsx +0 -362
- package/src/components/Paging/index.tsx +0 -321
- package/src/components/Panel/LabelEditor.tsx +0 -67
- package/src/components/Panel/NonResponsiveActions.tsx +0 -79
- package/src/components/Panel/__screenshots__/linux/panel-SomePanel.png +0 -0
- package/src/components/Panel/index.tsx +0 -912
- package/src/components/Panel/panel.screenshot.tsx +0 -29
- package/src/components/Paragraph/index.tsx +0 -43
- package/src/components/Popover/index.tsx +0 -68
- package/src/components/RadioGroup/index.tsx +0 -71
- package/src/components/Slider/index.tsx +0 -358
- package/src/components/Spacer/index.tsx +0 -142
- package/src/components/Spinner/index.tsx +0 -74
- package/src/components/Table/body.tsx +0 -109
- package/src/components/Table/cell.tsx +0 -136
- package/src/components/Table/header.tsx +0 -236
- package/src/components/Table/headerCell.tsx +0 -203
- package/src/components/Table/helpers.ts +0 -308
- package/src/components/Table/index.tsx +0 -797
- package/src/components/Table/row.tsx +0 -288
- package/src/components/Table/value.tsx +0 -28
- package/src/components/Tabs/content.tsx +0 -68
- package/src/components/Tabs/index.tsx +0 -124
- package/src/components/Tabs/item.tsx +0 -198
- package/src/components/Tabs/list.tsx +0 -381
- package/src/components/Tag/group.tsx +0 -73
- package/src/components/Tag/index.tsx +0 -463
- package/src/components/Textarea/index.tsx +0 -277
- package/src/components/TimeAgo/index.tsx +0 -15
- package/src/components/Tree/index.tsx +0 -271
- package/src/constants/animations.ts +0 -9
- package/src/constants/colors.ts +0 -13
- package/src/constants/paging.ts +0 -93
- package/src/constants/sizes.ts +0 -185
- package/src/constants/theme.ts +0 -122
- package/src/containers/Paging.tsx +0 -136
- package/src/containers/PopoverProvider.tsx +0 -124
- package/src/containers/ReqoreProvider.tsx +0 -289
- package/src/containers/ThemeProvider.tsx +0 -12
- package/src/containers/UIProvider.tsx +0 -101
- package/src/context/PopoverContext.tsx +0 -11
- package/src/context/ReqoreContext.tsx +0 -47
- package/src/context/ThemeContext.tsx +0 -4
- package/src/helpers/animations.ts +0 -13
- package/src/helpers/colors.ts +0 -335
- package/src/helpers/time.ts +0 -21
- package/src/helpers/utils.ts +0 -152
- package/src/hooks/useAutoFocus.ts +0 -106
- package/src/hooks/useCloneThroughFragments.ts +0 -39
- package/src/hooks/useCombinedRefs.ts +0 -26
- package/src/hooks/useLatestZIndex.ts +0 -13
- package/src/hooks/useOutsideClick.ts +0 -29
- package/src/hooks/usePaging.ts +0 -128
- package/src/hooks/usePopover.tsx +0 -220
- package/src/hooks/useQueryWithDelay.ts +0 -30
- package/src/hooks/useReqore.ts +0 -12
- package/src/hooks/useReqoreContext.ts +0 -16
- package/src/hooks/useReqoreEffect.ts +0 -49
- package/src/hooks/useTextareaAutoSize.ts +0 -22
- package/src/hooks/useTheme.ts +0 -48
- package/src/hooks/useTooltip.ts +0 -40
- package/src/hooks/useWhyDidYouUpdate.ts +0 -32
- package/src/icons.json +0 -2295
- package/src/index.tsx +0 -79
- package/src/mock/breadcrumbs.ts +0 -146
- package/src/mock/collectionData.tsx +0 -380
- package/src/mock/data.json +0 -11000
- package/src/mock/icons.ts +0 -32
- package/src/mock/menu.ts +0 -93
- package/src/mock/multiSelect.ts +0 -71
- package/src/mock/object.json +0 -317
- package/src/mock/styleMock.js +0 -1
- package/src/mock/tableData.ts +0 -64
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -27
- package/src/stories/Button/Button.stories.tsx +0 -405
- package/src/stories/Checkbox/Checkbox.stories.tsx +0 -75
- package/src/stories/Collection/Collection.stories.tsx +0 -317
- package/src/stories/Columns/Columns.stories.tsx +0 -158
- package/src/stories/Comment/Comment.stories.tsx +0 -136
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +0 -399
- package/src/stories/Drawer/Drawer.stories.tsx +0 -294
- package/src/stories/Dropdown/Dropdown.stories.tsx +0 -375
- package/src/stories/Dropdown/DropdownTests.stories.tsx +0 -111
- package/src/stories/ExportModal/ExportModal.stories.tsx +0 -18
- package/src/stories/Header/Header.stories.tsx +0 -108
- package/src/stories/Icon/Icon.stories.tsx +0 -162
- package/src/stories/Input/Input.stories.tsx +0 -220
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +0 -346
- package/src/stories/Label/Label.stories.tsx +0 -33
- package/src/stories/Menu/Menu.stories.tsx +0 -367
- package/src/stories/Message/Message.stories.tsx +0 -167
- package/src/stories/Modal/Manager.stories.tsx +0 -192
- package/src/stories/Modal/Modal.stories.tsx +0 -252
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +0 -140
- package/src/stories/Navbar/Navbar.stories.tsx +0 -119
- package/src/stories/Notifications/Interactive.stories.tsx +0 -117
- package/src/stories/Notifications/Notification.stories.tsx +0 -216
- package/src/stories/Notifications/Notifications.stories.tsx +0 -81
- package/src/stories/Paging/Paging.stories.tsx +0 -255
- package/src/stories/Panel/Panel.stories.tsx +0 -753
- package/src/stories/Paragraph/Paragraph.stories.tsx +0 -108
- package/src/stories/Popover/Popover.stories.tsx +0 -510
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +0 -212
- package/src/stories/Slider/Slider.stories.tsx +0 -173
- package/src/stories/Spacer/Spacer.stories.tsx +0 -100
- package/src/stories/Spinner/Spinner.stories.tsx +0 -82
- package/src/stories/Table/Table.stories.tsx +0 -571
- package/src/stories/Tabs/Tabs.stories.tsx +0 -346
- package/src/stories/Tag/Tag.stories.tsx +0 -381
- package/src/stories/Tag/TagGroup.stories.tsx +0 -307
- package/src/stories/TextArea/TextArea.stories.tsx +0 -287
- package/src/stories/TextArea/TextAreaTests.stories.tsx +0 -108
- package/src/stories/Tree/Tree.stories.tsx +0 -124
- package/src/stories/Wrapper.tsx +0 -13
- package/src/stories/utils/args.ts +0 -151
- package/src/stories/utils.ts +0 -39
- package/src/styles.ts +0 -124
- package/src/types/global.ts +0 -211
- package/src/types/icons.ts +0 -2272
- package/tsconfig.prod.json +0 -26
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import {
|
|
5
|
-
ReqoreContent,
|
|
6
|
-
ReqoreDropdown,
|
|
7
|
-
ReqoreInput,
|
|
8
|
-
ReqoreLayoutContent,
|
|
9
|
-
ReqoreUIProvider,
|
|
10
|
-
} from '../src';
|
|
11
|
-
import { IReqoreInputProps } from '../src/components/Input';
|
|
12
|
-
|
|
13
|
-
beforeAll(() => {
|
|
14
|
-
jest.setTimeout(30000);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('Renders <Dropdown /> properly', () => {
|
|
18
|
-
jest.useFakeTimers();
|
|
19
|
-
act(() => {
|
|
20
|
-
jest.advanceTimersByTime(1);
|
|
21
|
-
render(
|
|
22
|
-
<ReqoreUIProvider>
|
|
23
|
-
<ReqoreLayoutContent>
|
|
24
|
-
<ReqoreContent>
|
|
25
|
-
<ReqoreDropdown
|
|
26
|
-
items={[
|
|
27
|
-
{
|
|
28
|
-
selected: true,
|
|
29
|
-
label: 'Hello',
|
|
30
|
-
value: 'hello',
|
|
31
|
-
icon: 'SunCloudyLine',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: 'How are ya',
|
|
35
|
-
value: 'howareya',
|
|
36
|
-
icon: 'BatteryChargeFill',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
disabled: true,
|
|
40
|
-
label: 'i aM diSAblEd',
|
|
41
|
-
value: 'disabled',
|
|
42
|
-
icon: 'StopCircleLine',
|
|
43
|
-
},
|
|
44
|
-
]}
|
|
45
|
-
/>
|
|
46
|
-
</ReqoreContent>
|
|
47
|
-
</ReqoreLayoutContent>
|
|
48
|
-
</ReqoreUIProvider>
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
fireEvent.click(document.querySelector('.reqore-button')!);
|
|
53
|
-
jest.advanceTimersByTime(1);
|
|
54
|
-
|
|
55
|
-
expect(document.querySelector('.reqore-button')?.getAttribute('disabled')).toBe(null);
|
|
56
|
-
expect(document.querySelectorAll('.reqore-button').length).toBe(4);
|
|
57
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
58
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(3);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('Renders disabled <Dropdown /> when items are empty', () => {
|
|
62
|
-
jest.useFakeTimers();
|
|
63
|
-
act(() => {
|
|
64
|
-
render(
|
|
65
|
-
<ReqoreUIProvider>
|
|
66
|
-
<ReqoreLayoutContent>
|
|
67
|
-
<ReqoreContent>
|
|
68
|
-
<ReqoreDropdown />
|
|
69
|
-
</ReqoreContent>
|
|
70
|
-
</ReqoreLayoutContent>
|
|
71
|
-
</ReqoreUIProvider>
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
fireEvent.click(document.querySelector('.reqore-button')!);
|
|
76
|
-
|
|
77
|
-
expect(document.querySelector('.reqore-button')?.getAttribute('disabled')).toBe('');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('Renders disabled <Dropdown /> when items are not empty & disabled prop is true', () => {
|
|
81
|
-
jest.useFakeTimers();
|
|
82
|
-
act(() => {
|
|
83
|
-
render(
|
|
84
|
-
<ReqoreUIProvider>
|
|
85
|
-
<ReqoreLayoutContent>
|
|
86
|
-
<ReqoreContent>
|
|
87
|
-
<ReqoreDropdown
|
|
88
|
-
label='Disabled with items'
|
|
89
|
-
items={[
|
|
90
|
-
{
|
|
91
|
-
selected: true,
|
|
92
|
-
label: 'Hello',
|
|
93
|
-
value: 'hello',
|
|
94
|
-
icon: 'SunCloudyLine',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: 'How are ya',
|
|
98
|
-
value: 'howareya',
|
|
99
|
-
icon: 'BatteryChargeFill',
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
disabled: true,
|
|
103
|
-
label: 'i aM diSAblEd',
|
|
104
|
-
value: 'disabled',
|
|
105
|
-
icon: 'StopCircleLine',
|
|
106
|
-
},
|
|
107
|
-
]}
|
|
108
|
-
disabled
|
|
109
|
-
/>
|
|
110
|
-
</ReqoreContent>
|
|
111
|
-
</ReqoreLayoutContent>
|
|
112
|
-
</ReqoreUIProvider>
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
expect(document.querySelector('.reqore-button')?.getAttribute('disabled')).toBe('');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('Renders <Dropdown /> with custom component and custom handler', () => {
|
|
120
|
-
jest.useFakeTimers();
|
|
121
|
-
act(() => {
|
|
122
|
-
render(
|
|
123
|
-
<ReqoreUIProvider>
|
|
124
|
-
<ReqoreLayoutContent>
|
|
125
|
-
<ReqoreContent>
|
|
126
|
-
<ReqoreDropdown
|
|
127
|
-
component={ReqoreInput}
|
|
128
|
-
handler='focus'
|
|
129
|
-
useTargetWidth
|
|
130
|
-
width={500}
|
|
131
|
-
placeholder='Focus me to see some crazy stuff'
|
|
132
|
-
items={[
|
|
133
|
-
{
|
|
134
|
-
selected: true,
|
|
135
|
-
label: 'Hello',
|
|
136
|
-
value: 'hello',
|
|
137
|
-
icon: 'SunCloudyLine',
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
label: 'How are ya',
|
|
141
|
-
value: 'asg',
|
|
142
|
-
icon: 'BatteryChargeFill',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
disabled: true,
|
|
146
|
-
label: 'i aM diSAblEd',
|
|
147
|
-
value: 'hhhhh',
|
|
148
|
-
icon: 'StopCircleLine',
|
|
149
|
-
},
|
|
150
|
-
]}
|
|
151
|
-
/>
|
|
152
|
-
</ReqoreContent>
|
|
153
|
-
</ReqoreLayoutContent>
|
|
154
|
-
</ReqoreUIProvider>
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
const component = document.querySelector('.reqore-input');
|
|
159
|
-
|
|
160
|
-
if (component) {
|
|
161
|
-
fireEvent.focus(component);
|
|
162
|
-
jest.advanceTimersByTime(1);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
166
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(3);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test('Renders <Dropdown /> is opened by default', () => {
|
|
170
|
-
jest.useFakeTimers();
|
|
171
|
-
act(() => {
|
|
172
|
-
render(
|
|
173
|
-
<ReqoreUIProvider>
|
|
174
|
-
<ReqoreLayoutContent>
|
|
175
|
-
<ReqoreContent>
|
|
176
|
-
<ReqoreDropdown<IReqoreInputProps>
|
|
177
|
-
component={ReqoreInput}
|
|
178
|
-
handler='focus'
|
|
179
|
-
isDefaultOpen
|
|
180
|
-
useTargetWidth
|
|
181
|
-
width={500}
|
|
182
|
-
placeholder='Focus me to see some crazy stuff'
|
|
183
|
-
items={[
|
|
184
|
-
{
|
|
185
|
-
selected: true,
|
|
186
|
-
label: 'Hello',
|
|
187
|
-
value: 'hello',
|
|
188
|
-
icon: 'SunCloudyLine',
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
label: 'How are ya',
|
|
192
|
-
value: 'asg',
|
|
193
|
-
icon: 'BatteryChargeFill',
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
disabled: true,
|
|
197
|
-
label: 'i aM diSAblEd',
|
|
198
|
-
value: 'hhhhh',
|
|
199
|
-
icon: 'StopCircleLine',
|
|
200
|
-
},
|
|
201
|
-
]}
|
|
202
|
-
/>
|
|
203
|
-
</ReqoreContent>
|
|
204
|
-
</ReqoreLayoutContent>
|
|
205
|
-
</ReqoreUIProvider>
|
|
206
|
-
);
|
|
207
|
-
jest.advanceTimersByTime(1);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
211
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(3);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
test('Renders <Dropdown /> and calls a function on item click, closes the dropdown', () => {
|
|
215
|
-
jest.useFakeTimers();
|
|
216
|
-
const onClick = jest.fn();
|
|
217
|
-
|
|
218
|
-
act(() => {
|
|
219
|
-
render(
|
|
220
|
-
<ReqoreUIProvider>
|
|
221
|
-
<ReqoreLayoutContent>
|
|
222
|
-
<ReqoreContent>
|
|
223
|
-
<ReqoreDropdown
|
|
224
|
-
items={[
|
|
225
|
-
{
|
|
226
|
-
selected: true,
|
|
227
|
-
label: 'Hello',
|
|
228
|
-
value: 'hello',
|
|
229
|
-
icon: 'SunCloudyLine',
|
|
230
|
-
onClick,
|
|
231
|
-
},
|
|
232
|
-
]}
|
|
233
|
-
/>
|
|
234
|
-
</ReqoreContent>
|
|
235
|
-
</ReqoreLayoutContent>
|
|
236
|
-
</ReqoreUIProvider>
|
|
237
|
-
);
|
|
238
|
-
jest.advanceTimersByTime(1);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
fireEvent.click(document.querySelector('.reqore-button')!);
|
|
242
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
243
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(1);
|
|
244
|
-
|
|
245
|
-
fireEvent.click(document.querySelector('.reqore-menu-item')!);
|
|
246
|
-
expect(onClick).toHaveBeenCalledWith(
|
|
247
|
-
expect.objectContaining({
|
|
248
|
-
selected: true,
|
|
249
|
-
label: 'Hello',
|
|
250
|
-
value: 'hello',
|
|
251
|
-
icon: 'SunCloudyLine',
|
|
252
|
-
onClick,
|
|
253
|
-
})
|
|
254
|
-
);
|
|
255
|
-
});
|
|
256
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(0);
|
|
257
|
-
|
|
258
|
-
test('Renders filterable <Dropdown /> and filters items correctly', () => {
|
|
259
|
-
jest.useFakeTimers();
|
|
260
|
-
act(() => {
|
|
261
|
-
render(
|
|
262
|
-
<ReqoreUIProvider>
|
|
263
|
-
<ReqoreLayoutContent>
|
|
264
|
-
<ReqoreContent>
|
|
265
|
-
<ReqoreDropdown
|
|
266
|
-
filterable
|
|
267
|
-
items={[
|
|
268
|
-
{
|
|
269
|
-
selected: true,
|
|
270
|
-
label: 'Hello',
|
|
271
|
-
value: 'hello',
|
|
272
|
-
icon: 'SunCloudyLine',
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
label: 'How are ya',
|
|
276
|
-
value: 'howareya',
|
|
277
|
-
icon: 'BatteryChargeFill',
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
disabled: true,
|
|
281
|
-
label: 'i aM diSAblEd',
|
|
282
|
-
value: 'disabled',
|
|
283
|
-
icon: 'StopCircleLine',
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
value: 'onlyvalue',
|
|
287
|
-
icon: 'StopCircleLine',
|
|
288
|
-
},
|
|
289
|
-
]}
|
|
290
|
-
/>
|
|
291
|
-
</ReqoreContent>
|
|
292
|
-
</ReqoreLayoutContent>
|
|
293
|
-
</ReqoreUIProvider>
|
|
294
|
-
);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
fireEvent.click(document.querySelector('.reqore-button')!);
|
|
298
|
-
jest.advanceTimersByTime(1);
|
|
299
|
-
fireEvent.change(document.querySelector('.reqore-input')!, {
|
|
300
|
-
target: { value: 'how' },
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
304
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(1);
|
|
305
|
-
|
|
306
|
-
fireEvent.change(document.querySelector('.reqore-input')!, {
|
|
307
|
-
target: { value: '' },
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(4);
|
|
311
|
-
|
|
312
|
-
// Search in value only
|
|
313
|
-
fireEvent.change(document.querySelector('.reqore-input')!, {
|
|
314
|
-
target: { value: 'onlyvalue' },
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(1);
|
|
318
|
-
|
|
319
|
-
fireEvent.change(document.querySelector('.reqore-input')!, {
|
|
320
|
-
target: { value: 'asfd' },
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(0);
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
const MultiSelectDropdown = ({ onChange }) => {
|
|
327
|
-
const [selected, setSelected] = useState<string[]>([]);
|
|
328
|
-
|
|
329
|
-
useEffect(() => {
|
|
330
|
-
onChange(selected);
|
|
331
|
-
}, [selected]);
|
|
332
|
-
|
|
333
|
-
return (
|
|
334
|
-
<ReqoreDropdown
|
|
335
|
-
multiSelect
|
|
336
|
-
onItemSelect={({ value }) => setSelected([...selected, value])}
|
|
337
|
-
items={[
|
|
338
|
-
{
|
|
339
|
-
label: 'Item 1',
|
|
340
|
-
value: 'item-1',
|
|
341
|
-
selected: selected.includes('item-1'),
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
label: 'Item 2',
|
|
345
|
-
value: 'item-2',
|
|
346
|
-
selected: selected.includes('item-2'),
|
|
347
|
-
},
|
|
348
|
-
]}
|
|
349
|
-
/>
|
|
350
|
-
);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
test('Renders <Dropdown /> and updates its items when state changes, does not close dropdown', () => {
|
|
354
|
-
const fn = jest.fn();
|
|
355
|
-
|
|
356
|
-
act(() => {
|
|
357
|
-
render(
|
|
358
|
-
<ReqoreUIProvider>
|
|
359
|
-
<ReqoreLayoutContent>
|
|
360
|
-
<ReqoreContent>
|
|
361
|
-
<MultiSelectDropdown onChange={fn} />
|
|
362
|
-
</ReqoreContent>
|
|
363
|
-
</ReqoreLayoutContent>
|
|
364
|
-
</ReqoreUIProvider>
|
|
365
|
-
);
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
fireEvent.click(document.querySelector('.reqore-button')!);
|
|
369
|
-
|
|
370
|
-
expect(document.querySelectorAll('.reqore-button').length).toBe(3);
|
|
371
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
372
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(2);
|
|
373
|
-
|
|
374
|
-
fireEvent.click(document.querySelectorAll('.reqore-menu-item')[0]);
|
|
375
|
-
expect(fn).toHaveBeenNthCalledWith(2, ['item-1']);
|
|
376
|
-
|
|
377
|
-
fireEvent.click(document.querySelectorAll('.reqore-menu-item')[1]);
|
|
378
|
-
expect(fn).toHaveBeenNthCalledWith(3, ['item-1', 'item-2']);
|
|
379
|
-
|
|
380
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
381
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ReqoreContent,
|
|
5
|
-
ReqoreEffect,
|
|
6
|
-
ReqoreLayoutContent,
|
|
7
|
-
ReqoreTextEffect,
|
|
8
|
-
ReqoreUIProvider,
|
|
9
|
-
} from '../src';
|
|
10
|
-
|
|
11
|
-
test('Renders <ReqoreEffect /> properly', () => {
|
|
12
|
-
render(
|
|
13
|
-
<ReqoreUIProvider>
|
|
14
|
-
<ReqoreLayoutContent>
|
|
15
|
-
<ReqoreContent>
|
|
16
|
-
<ReqoreEffect
|
|
17
|
-
as='div'
|
|
18
|
-
effect={{
|
|
19
|
-
gradient: {
|
|
20
|
-
type: 'radial',
|
|
21
|
-
shape: 'circle',
|
|
22
|
-
colors: {
|
|
23
|
-
0: 'danger:lighten:2',
|
|
24
|
-
100: 'info:darken:1',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
spaced: 10,
|
|
28
|
-
uppercase: true,
|
|
29
|
-
weight: 'bold',
|
|
30
|
-
color: 'main',
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
33
|
-
This is a test
|
|
34
|
-
</ReqoreEffect>
|
|
35
|
-
</ReqoreContent>
|
|
36
|
-
</ReqoreLayoutContent>
|
|
37
|
-
</ReqoreUIProvider>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(document.querySelectorAll('.reqore-effect').length).toBe(1);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('Renders <ReqoreTextEffect /> properly', () => {
|
|
44
|
-
render(
|
|
45
|
-
<ReqoreUIProvider>
|
|
46
|
-
<ReqoreLayoutContent>
|
|
47
|
-
<ReqoreContent>
|
|
48
|
-
<ReqoreTextEffect
|
|
49
|
-
as='p'
|
|
50
|
-
effect={{
|
|
51
|
-
gradient: {
|
|
52
|
-
colors: {
|
|
53
|
-
0: '#ff0000',
|
|
54
|
-
100: '#00ff00',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
spaced: 10,
|
|
58
|
-
uppercase: true,
|
|
59
|
-
weight: 'thin',
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
This is a test
|
|
63
|
-
</ReqoreTextEffect>
|
|
64
|
-
</ReqoreContent>
|
|
65
|
-
</ReqoreLayoutContent>
|
|
66
|
-
</ReqoreUIProvider>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
expect(document.querySelectorAll('.reqore-text-effect').length).toBe(1);
|
|
70
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ReqoreH1,
|
|
5
|
-
ReqoreH2,
|
|
6
|
-
ReqoreH3,
|
|
7
|
-
ReqoreH4,
|
|
8
|
-
ReqoreH5,
|
|
9
|
-
ReqoreH6,
|
|
10
|
-
ReqoreUIProvider,
|
|
11
|
-
} from '../src';
|
|
12
|
-
|
|
13
|
-
test('<Heading /> renders properly', () => {
|
|
14
|
-
jest.useFakeTimers();
|
|
15
|
-
|
|
16
|
-
render(
|
|
17
|
-
<ReqoreUIProvider>
|
|
18
|
-
<ReqoreH1>H1</ReqoreH1>
|
|
19
|
-
<ReqoreH2>H2</ReqoreH2>
|
|
20
|
-
<ReqoreH3>H3</ReqoreH3>
|
|
21
|
-
<ReqoreH4>H4</ReqoreH4>
|
|
22
|
-
<ReqoreH5>H5</ReqoreH5>
|
|
23
|
-
<ReqoreH6>H6</ReqoreH6>
|
|
24
|
-
</ReqoreUIProvider>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
expect(screen.getAllByText('H1')).toBeTruthy();
|
|
28
|
-
expect(screen.getAllByText('H2')).toBeTruthy();
|
|
29
|
-
expect(screen.getAllByText('H3')).toBeTruthy();
|
|
30
|
-
expect(screen.getAllByText('H4')).toBeTruthy();
|
|
31
|
-
expect(screen.getAllByText('H5')).toBeTruthy();
|
|
32
|
-
expect(screen.getAllByText('H6')).toBeTruthy();
|
|
33
|
-
|
|
34
|
-
expect(document.querySelectorAll('h1').length).toBe(1);
|
|
35
|
-
expect(document.querySelectorAll('h2').length).toBe(1);
|
|
36
|
-
expect(document.querySelectorAll('h3').length).toBe(1);
|
|
37
|
-
expect(document.querySelectorAll('h4').length).toBe(1);
|
|
38
|
-
expect(document.querySelectorAll('h5').length).toBe(1);
|
|
39
|
-
expect(document.querySelectorAll('h6').length).toBe(1);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('Tooltip on <Heading /> works', () => {
|
|
43
|
-
jest.useFakeTimers();
|
|
44
|
-
|
|
45
|
-
render(
|
|
46
|
-
<ReqoreUIProvider>
|
|
47
|
-
<ReqoreH3 tooltip='test'>Test</ReqoreH3>
|
|
48
|
-
</ReqoreUIProvider>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(0);
|
|
52
|
-
|
|
53
|
-
fireEvent.mouseEnter(document.querySelectorAll('h3')[0]);
|
|
54
|
-
|
|
55
|
-
jest.advanceTimersByTime(1);
|
|
56
|
-
|
|
57
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
58
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { hexAToRGBA, shouldDarken } from '../../src/helpers/colors';
|
|
2
|
-
|
|
3
|
-
test('Tests whether a color should be darkened', () => {
|
|
4
|
-
expect(shouldDarken('#000000')).toBe(false);
|
|
5
|
-
expect(shouldDarken('#ffffff')).toBe(true);
|
|
6
|
-
expect(shouldDarken('#00000020')).toBe(false);
|
|
7
|
-
expect(shouldDarken('rgba(255, 255, 255, 0.1)')).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test('Transforms hex color with alpha to rgba', () => {
|
|
11
|
-
expect(hexAToRGBA('#000000')).toEqual('rgba(0, 0, 0, 1.00)');
|
|
12
|
-
expect(hexAToRGBA('#000')).toEqual('rgba(0, 0, 0, 1.00)');
|
|
13
|
-
expect(hexAToRGBA('#333')).toEqual('rgba(51, 51, 51, 1.00)');
|
|
14
|
-
expect(hexAToRGBA('#00000050')).toEqual('rgba(0, 0, 0, 0.31)');
|
|
15
|
-
expect(hexAToRGBA('#00000000')).toEqual('rgba(0, 0, 0, 0.00)');
|
|
16
|
-
expect(hexAToRGBA('rgb(0, 0, 0)')).toEqual('rgb(0, 0, 0)');
|
|
17
|
-
expect(hexAToRGBA('rgba(0, 0, 0, 1)')).toEqual('rgba(0, 0, 0, 1)');
|
|
18
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getColumnsByPinType,
|
|
3
|
-
getColumnsCount,
|
|
4
|
-
getOnlyShownColumns,
|
|
5
|
-
hasHiddenColumns,
|
|
6
|
-
updateColumnData,
|
|
7
|
-
} from '../../src/components/Table/helpers';
|
|
8
|
-
import { testColumns } from '../../src/mock/tableData';
|
|
9
|
-
|
|
10
|
-
test('Updates top level column width', () => {
|
|
11
|
-
const columns = [...testColumns];
|
|
12
|
-
|
|
13
|
-
expect(columns[0].width).toBe(50);
|
|
14
|
-
|
|
15
|
-
const newColumns = updateColumnData(columns, 'id', 'resizedWidth', 100);
|
|
16
|
-
|
|
17
|
-
expect(newColumns[0].width).toBe(50);
|
|
18
|
-
expect(newColumns[0].resizedWidth).toBe(100);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('Updates group level column width', () => {
|
|
22
|
-
const columns = [...testColumns];
|
|
23
|
-
|
|
24
|
-
expect(columns[1].header!.columns![0].width).toBe(150);
|
|
25
|
-
|
|
26
|
-
const newColumns = updateColumnData(columns, 'firstName', 'resizedWidth', 250);
|
|
27
|
-
|
|
28
|
-
expect(newColumns[1].header!.columns![0].width).toBe(150);
|
|
29
|
-
expect(newColumns[1].header!.columns![0].resizedWidth).toBe(250);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('Filters out hidden columns', () => {
|
|
33
|
-
const columns = [...testColumns];
|
|
34
|
-
|
|
35
|
-
expect(getColumnsCount(columns)).toBe(8);
|
|
36
|
-
|
|
37
|
-
columns[1].header!.columns![0].show = false;
|
|
38
|
-
columns[1].header!.columns![1].show = false;
|
|
39
|
-
columns[3].show = false;
|
|
40
|
-
columns[4].header!.columns![1].show = false;
|
|
41
|
-
|
|
42
|
-
const newColumns = getOnlyShownColumns(columns);
|
|
43
|
-
|
|
44
|
-
expect(getColumnsCount(newColumns)).toBe(4);
|
|
45
|
-
expect(hasHiddenColumns(columns)).toBe(true);
|
|
46
|
-
expect(hasHiddenColumns(newColumns)).toBe(false);
|
|
47
|
-
expect(newColumns[1].dataId).toBe('address');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('Returns pinned columns', () => {
|
|
51
|
-
const columns = [...testColumns];
|
|
52
|
-
|
|
53
|
-
expect(getColumnsCount(columns)).toBe(8);
|
|
54
|
-
|
|
55
|
-
columns[1].header!.columns![1].pin = 'left';
|
|
56
|
-
columns[0].pin = 'left';
|
|
57
|
-
columns[4].header!.columns![0].pin = 'right';
|
|
58
|
-
columns[4].header!.columns![1].pin = 'right';
|
|
59
|
-
|
|
60
|
-
const leftPinColumns = getColumnsByPinType(columns, 'left');
|
|
61
|
-
const rightPinColumns = getColumnsByPinType(columns, 'right');
|
|
62
|
-
const mainColumns = getColumnsByPinType(columns, 'main');
|
|
63
|
-
|
|
64
|
-
expect(getColumnsCount(leftPinColumns)).toBe(2);
|
|
65
|
-
expect(getColumnsCount(rightPinColumns)).toBe(2);
|
|
66
|
-
expect(getColumnsCount(mainColumns)).toBe(4);
|
|
67
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { renderHook } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ReqoreUIProvider, useLatestZIndex } from '../../src';
|
|
4
|
-
|
|
5
|
-
test('useLatestZIndex returns incremental z indexes', () => {
|
|
6
|
-
const wrapper = ({ children }: any) => <ReqoreUIProvider>{children}</ReqoreUIProvider>;
|
|
7
|
-
const { result } = renderHook(() => useLatestZIndex(), { wrapper });
|
|
8
|
-
|
|
9
|
-
expect(result.current).toEqual(9002);
|
|
10
|
-
});
|