@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
package/__tests__/tabs.test.tsx
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { ReqoreLayoutContent, ReqoreTabs, ReqoreTabsContent, ReqoreUIProvider } from '../src';
|
|
4
|
-
|
|
5
|
-
test('Renders full <Tabs /> properly', () => {
|
|
6
|
-
render(
|
|
7
|
-
<div style={{ width: '1000px' }}>
|
|
8
|
-
<ReqoreUIProvider>
|
|
9
|
-
<ReqoreLayoutContent>
|
|
10
|
-
<ReqoreTabs
|
|
11
|
-
tabs={[
|
|
12
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
13
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
14
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
15
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
16
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
17
|
-
]}
|
|
18
|
-
>
|
|
19
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
20
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
21
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
22
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
23
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
24
|
-
</ReqoreTabs>
|
|
25
|
-
</ReqoreLayoutContent>
|
|
26
|
-
</ReqoreUIProvider>
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
expect(document.querySelectorAll('.reqore-tabs-list').length).toBe(1);
|
|
31
|
-
expect(document.querySelectorAll('.reqore-tabs').length).toBe(1);
|
|
32
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item').length).toBe(5);
|
|
33
|
-
expect(document.querySelectorAll('.reqore-tabs-content').length).toBe(1);
|
|
34
|
-
expect(screen.getByText('Tab 1 content')).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('Renders shortened <Tabs /> properly', () => {
|
|
38
|
-
const fn = jest.fn();
|
|
39
|
-
act(() => {
|
|
40
|
-
render(
|
|
41
|
-
<ReqoreUIProvider>
|
|
42
|
-
<ReqoreLayoutContent>
|
|
43
|
-
<ReqoreTabs
|
|
44
|
-
_testWidth={300}
|
|
45
|
-
onTabChange={fn}
|
|
46
|
-
tabs={[
|
|
47
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
48
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
49
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
50
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
51
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
52
|
-
]}
|
|
53
|
-
>
|
|
54
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
55
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
56
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
57
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
58
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
59
|
-
</ReqoreTabs>
|
|
60
|
-
</ReqoreLayoutContent>
|
|
61
|
-
</ReqoreUIProvider>
|
|
62
|
-
);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item').length).toBe(2);
|
|
66
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item-menu').length).toBe(1);
|
|
67
|
-
|
|
68
|
-
fireEvent.mouseEnter(document.querySelector('.reqore-tabs-list-item-menu')!);
|
|
69
|
-
|
|
70
|
-
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
71
|
-
expect(document.querySelectorAll('.reqore-menu').length).toBe(1);
|
|
72
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(4);
|
|
73
|
-
|
|
74
|
-
fireEvent.click(document.querySelectorAll('.reqore-menu-item')[0]);
|
|
75
|
-
|
|
76
|
-
expect(fn).toBeCalledTimes(1);
|
|
77
|
-
expect(fn).toBeCalledWith('tab2');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('Can select hidden <Tabs /> when shortened', () => {
|
|
81
|
-
act(() => {
|
|
82
|
-
render(
|
|
83
|
-
<ReqoreUIProvider>
|
|
84
|
-
<ReqoreLayoutContent>
|
|
85
|
-
<ReqoreTabs
|
|
86
|
-
_testWidth={300}
|
|
87
|
-
tabs={[
|
|
88
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
89
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
90
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
91
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
92
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
93
|
-
]}
|
|
94
|
-
>
|
|
95
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
96
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
97
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
98
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
99
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
100
|
-
</ReqoreTabs>
|
|
101
|
-
</ReqoreLayoutContent>
|
|
102
|
-
</ReqoreUIProvider>
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item').length).toBe(2);
|
|
107
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item-menu').length).toBe(1);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
test('Default active tab can be specified', () => {
|
|
111
|
-
act(() => {
|
|
112
|
-
render(
|
|
113
|
-
<ReqoreUIProvider>
|
|
114
|
-
<ReqoreLayoutContent>
|
|
115
|
-
<ReqoreTabs
|
|
116
|
-
tabs={[
|
|
117
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
118
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
119
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
120
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
121
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
122
|
-
]}
|
|
123
|
-
activeTab='tab4'
|
|
124
|
-
>
|
|
125
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
126
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
127
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
128
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
129
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
130
|
-
</ReqoreTabs>
|
|
131
|
-
</ReqoreLayoutContent>
|
|
132
|
-
</ReqoreUIProvider>
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
expect(screen.getByText('Tab 4 content')).toBeTruthy();
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
test('Changes tab and runs callback', () => {
|
|
140
|
-
const cb = jest.fn();
|
|
141
|
-
|
|
142
|
-
act(() => {
|
|
143
|
-
render(
|
|
144
|
-
<ReqoreUIProvider>
|
|
145
|
-
<ReqoreLayoutContent>
|
|
146
|
-
<ReqoreTabs
|
|
147
|
-
tabs={[
|
|
148
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
149
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
150
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
151
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
152
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
153
|
-
]}
|
|
154
|
-
onTabChange={cb}
|
|
155
|
-
>
|
|
156
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
157
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
158
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
159
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
160
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
161
|
-
</ReqoreTabs>
|
|
162
|
-
</ReqoreLayoutContent>
|
|
163
|
-
</ReqoreUIProvider>
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
fireEvent.click(document.querySelectorAll('.reqore-tabs-list-item')[2]);
|
|
168
|
-
|
|
169
|
-
expect(screen.getByText('Tab 3 content')).toBeTruthy();
|
|
170
|
-
expect(cb).toHaveBeenCalledWith('tab3');
|
|
171
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item-active').length).toBe(1);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('Does not change tab and run callback when disabled', () => {
|
|
175
|
-
const cb = jest.fn();
|
|
176
|
-
|
|
177
|
-
act(() => {
|
|
178
|
-
render(
|
|
179
|
-
<ReqoreUIProvider>
|
|
180
|
-
<ReqoreLayoutContent>
|
|
181
|
-
<ReqoreTabs
|
|
182
|
-
tabs={[
|
|
183
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
184
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
185
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3', disabled: true },
|
|
186
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
187
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
188
|
-
]}
|
|
189
|
-
onTabChange={cb}
|
|
190
|
-
>
|
|
191
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
192
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
193
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
194
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
195
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
196
|
-
</ReqoreTabs>
|
|
197
|
-
</ReqoreLayoutContent>
|
|
198
|
-
</ReqoreUIProvider>
|
|
199
|
-
);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
fireEvent.click(document.querySelectorAll('.reqore-tabs-list-item')[2]);
|
|
203
|
-
|
|
204
|
-
expect(screen.getByText('Tab 1 content')).toBeTruthy();
|
|
205
|
-
expect(cb).not.toHaveBeenCalled();
|
|
206
|
-
expect(document.querySelectorAll('.reqore-tabs-list-item-active').length).toBe(1);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('Does not change tab when mounted and active tab is set', () => {
|
|
210
|
-
const cb = jest.fn();
|
|
211
|
-
|
|
212
|
-
act(() => {
|
|
213
|
-
render(
|
|
214
|
-
<ReqoreUIProvider>
|
|
215
|
-
<ReqoreLayoutContent>
|
|
216
|
-
<ReqoreTabs
|
|
217
|
-
tabs={[
|
|
218
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
219
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
220
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3', disabled: true },
|
|
221
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
222
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
223
|
-
]}
|
|
224
|
-
activeTab={'tab4'}
|
|
225
|
-
onTabChange={cb}
|
|
226
|
-
>
|
|
227
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
228
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
229
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
230
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
231
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
232
|
-
</ReqoreTabs>
|
|
233
|
-
</ReqoreLayoutContent>
|
|
234
|
-
</ReqoreUIProvider>
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
expect(cb).not.toHaveBeenCalled();
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
test('Changes tab programatically and runs callback', () => {
|
|
242
|
-
const cb = jest.fn();
|
|
243
|
-
|
|
244
|
-
const Component = () => {
|
|
245
|
-
const [activeTab, setActiveTab] = useState('tab1');
|
|
246
|
-
|
|
247
|
-
return (
|
|
248
|
-
<ReqoreUIProvider>
|
|
249
|
-
<ReqoreLayoutContent>
|
|
250
|
-
<ReqoreTabs
|
|
251
|
-
tabs={[
|
|
252
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
253
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
254
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3', disabled: true },
|
|
255
|
-
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
256
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
257
|
-
]}
|
|
258
|
-
onTabChange={cb}
|
|
259
|
-
activeTab={activeTab}
|
|
260
|
-
>
|
|
261
|
-
<ReqoreTabsContent tabId='tab1'>
|
|
262
|
-
<button onClick={() => setActiveTab('tab2')}>Change active tab</button>
|
|
263
|
-
</ReqoreTabsContent>
|
|
264
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
265
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
266
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
267
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
268
|
-
</ReqoreTabs>
|
|
269
|
-
</ReqoreLayoutContent>
|
|
270
|
-
</ReqoreUIProvider>
|
|
271
|
-
);
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
act(() => {
|
|
275
|
-
render(<Component />);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
fireEvent.click(screen.getByText('Change active tab'));
|
|
279
|
-
|
|
280
|
-
expect(screen.getByText('Tab 2 content')).toBeTruthy();
|
|
281
|
-
expect(cb).toHaveBeenCalled();
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
test('Closable tab can be closed if not disabled', () => {
|
|
285
|
-
const cb = jest.fn();
|
|
286
|
-
|
|
287
|
-
act(() => {
|
|
288
|
-
render(
|
|
289
|
-
<ReqoreUIProvider>
|
|
290
|
-
<ReqoreLayoutContent>
|
|
291
|
-
<ReqoreTabs
|
|
292
|
-
tabs={[
|
|
293
|
-
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
294
|
-
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
295
|
-
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3', disabled: true },
|
|
296
|
-
{
|
|
297
|
-
label: 'Tab 4',
|
|
298
|
-
icon: 'Home3Line',
|
|
299
|
-
id: 'tab4',
|
|
300
|
-
onCloseClick: cb,
|
|
301
|
-
},
|
|
302
|
-
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
303
|
-
]}
|
|
304
|
-
onTabChange={cb}
|
|
305
|
-
>
|
|
306
|
-
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
307
|
-
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
308
|
-
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
309
|
-
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
310
|
-
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
311
|
-
</ReqoreTabs>
|
|
312
|
-
</ReqoreLayoutContent>
|
|
313
|
-
</ReqoreUIProvider>
|
|
314
|
-
);
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
fireEvent.click(document.querySelectorAll('.reqore-tabs-list-item-close')[0]);
|
|
318
|
-
|
|
319
|
-
expect(cb).toHaveBeenCalledWith('tab4');
|
|
320
|
-
expect(screen.getByText('Tab 1 content')).toBeTruthy();
|
|
321
|
-
});
|
package/__tests__/tag.test.tsx
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
-
import { noop } from 'lodash';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
ReqoreContent,
|
|
6
|
-
ReqoreControlGroup,
|
|
7
|
-
ReqoreLayoutContent,
|
|
8
|
-
ReqoreTag,
|
|
9
|
-
ReqoreTagGroup,
|
|
10
|
-
ReqoreUIProvider,
|
|
11
|
-
} from '../src';
|
|
12
|
-
|
|
13
|
-
test('Renders <Tag /> properly', () => {
|
|
14
|
-
render(
|
|
15
|
-
<ReqoreUIProvider>
|
|
16
|
-
<ReqoreLayoutContent>
|
|
17
|
-
<ReqoreContent>
|
|
18
|
-
<ReqoreControlGroup minimal>
|
|
19
|
-
<ReqoreTag icon='24HoursLine' rightIcon='4KLine' onClick={noop} onRemoveClick={noop} />
|
|
20
|
-
<ReqoreTag
|
|
21
|
-
icon='24HoursLine'
|
|
22
|
-
rightIcon='4KLine'
|
|
23
|
-
onClick={noop}
|
|
24
|
-
onRemoveClick={noop}
|
|
25
|
-
size='big'
|
|
26
|
-
/>
|
|
27
|
-
<ReqoreTag
|
|
28
|
-
icon='24HoursLine'
|
|
29
|
-
rightIcon='4KLine'
|
|
30
|
-
onClick={noop}
|
|
31
|
-
onRemoveClick={noop}
|
|
32
|
-
size='small'
|
|
33
|
-
/>
|
|
34
|
-
</ReqoreControlGroup>
|
|
35
|
-
</ReqoreContent>
|
|
36
|
-
</ReqoreLayoutContent>
|
|
37
|
-
</ReqoreUIProvider>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
expect(document.querySelectorAll('.reqore-tag').length).toBe(3);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('Renders <Tag /> group properly', () => {
|
|
44
|
-
render(
|
|
45
|
-
<ReqoreUIProvider>
|
|
46
|
-
<ReqoreLayoutContent>
|
|
47
|
-
<ReqoreContent>
|
|
48
|
-
<ReqoreControlGroup minimal>
|
|
49
|
-
<ReqoreTagGroup>
|
|
50
|
-
<ReqoreTag
|
|
51
|
-
icon='24HoursLine'
|
|
52
|
-
rightIcon='4KLine'
|
|
53
|
-
onClick={noop}
|
|
54
|
-
onRemoveClick={noop}
|
|
55
|
-
label='Label'
|
|
56
|
-
/>
|
|
57
|
-
<ReqoreTag
|
|
58
|
-
icon='24HoursLine'
|
|
59
|
-
rightIcon='4KLine'
|
|
60
|
-
onClick={noop}
|
|
61
|
-
onRemoveClick={noop}
|
|
62
|
-
size='big'
|
|
63
|
-
/>
|
|
64
|
-
<ReqoreTag
|
|
65
|
-
icon='24HoursLine'
|
|
66
|
-
rightIcon='4KLine'
|
|
67
|
-
onClick={noop}
|
|
68
|
-
onRemoveClick={noop}
|
|
69
|
-
size='small'
|
|
70
|
-
label='Wazzup'
|
|
71
|
-
/>
|
|
72
|
-
</ReqoreTagGroup>
|
|
73
|
-
</ReqoreControlGroup>
|
|
74
|
-
</ReqoreContent>
|
|
75
|
-
</ReqoreLayoutContent>
|
|
76
|
-
</ReqoreUIProvider>
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
expect(document.querySelectorAll('.reqore-tag').length).toBe(3);
|
|
80
|
-
expect(document.querySelectorAll('.reqore-tag-group').length).toBe(1);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('Renders <Tag /> without remove button if disabled', () => {
|
|
84
|
-
render(
|
|
85
|
-
<ReqoreUIProvider>
|
|
86
|
-
<ReqoreLayoutContent>
|
|
87
|
-
<ReqoreContent>
|
|
88
|
-
<ReqoreControlGroup minimal>
|
|
89
|
-
<ReqoreTagGroup>
|
|
90
|
-
<ReqoreTag
|
|
91
|
-
icon='24HoursLine'
|
|
92
|
-
rightIcon='4KLine'
|
|
93
|
-
onClick={noop}
|
|
94
|
-
onRemoveClick={noop}
|
|
95
|
-
label='Label'
|
|
96
|
-
disabled
|
|
97
|
-
/>
|
|
98
|
-
</ReqoreTagGroup>
|
|
99
|
-
</ReqoreControlGroup>
|
|
100
|
-
</ReqoreContent>
|
|
101
|
-
</ReqoreLayoutContent>
|
|
102
|
-
</ReqoreUIProvider>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
expect(document.querySelectorAll('.reqore-tag-remove').length).toBe(0);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('Fires onClick and onRemoveClick <Tag /> events', () => {
|
|
109
|
-
const clickFn = jest.fn();
|
|
110
|
-
const removeClickFn = jest.fn();
|
|
111
|
-
|
|
112
|
-
render(
|
|
113
|
-
<ReqoreUIProvider>
|
|
114
|
-
<ReqoreLayoutContent>
|
|
115
|
-
<ReqoreContent>
|
|
116
|
-
<ReqoreControlGroup minimal>
|
|
117
|
-
<ReqoreTagGroup>
|
|
118
|
-
<ReqoreTag
|
|
119
|
-
icon='24HoursLine'
|
|
120
|
-
rightIcon='4KLine'
|
|
121
|
-
label='Test'
|
|
122
|
-
onClick={clickFn}
|
|
123
|
-
onRemoveClick={removeClickFn}
|
|
124
|
-
/>
|
|
125
|
-
</ReqoreTagGroup>
|
|
126
|
-
</ReqoreControlGroup>
|
|
127
|
-
</ReqoreContent>
|
|
128
|
-
</ReqoreLayoutContent>
|
|
129
|
-
</ReqoreUIProvider>
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
fireEvent.click(document.querySelector('.reqore-tag-content'));
|
|
133
|
-
|
|
134
|
-
expect(clickFn).toHaveBeenCalledTimes(1);
|
|
135
|
-
expect(removeClickFn).not.toHaveBeenCalled();
|
|
136
|
-
|
|
137
|
-
fireEvent.click(document.querySelector('.reqore-tag-remove'));
|
|
138
|
-
|
|
139
|
-
expect(clickFn).toHaveBeenCalledTimes(1);
|
|
140
|
-
expect(removeClickFn).toHaveBeenCalledTimes(1);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('Renders <Tag /> with the label key', () => {
|
|
144
|
-
render(
|
|
145
|
-
<ReqoreUIProvider>
|
|
146
|
-
<ReqoreLayoutContent>
|
|
147
|
-
<ReqoreContent>
|
|
148
|
-
<ReqoreControlGroup minimal>
|
|
149
|
-
<ReqoreTagGroup>
|
|
150
|
-
<ReqoreTag icon='24HoursLine' rightIcon='4KLine' label='Label' labelKey='label key' />
|
|
151
|
-
</ReqoreTagGroup>
|
|
152
|
-
</ReqoreControlGroup>
|
|
153
|
-
</ReqoreContent>
|
|
154
|
-
</ReqoreLayoutContent>
|
|
155
|
-
</ReqoreUIProvider>
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
// Get the label key by text from screen
|
|
159
|
-
expect(screen.getByText('label key')).toBeTruthy();
|
|
160
|
-
});
|