@qoretechnologies/reqore 0.19.6 → 0.19.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/beta_release.yml +12 -5
- package/.gitpod.yml +0 -14
- package/__tests__/button.test.tsx +116 -14
- package/__tests__/drawer.test.tsx +1 -6
- package/__tests__/menu.test.tsx +4 -12
- package/__tests__/tabs.test.tsx +40 -54
- package/build-storybook.log +3189 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +17 -7
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +41 -47
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +1 -1
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Menu/item.d.ts +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +2 -1
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +3 -2
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +1 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/index.d.ts +7 -4
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +6 -6
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +2 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +23 -18
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +7 -17
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +4 -4
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -7
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +4 -1
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/time.d.ts +6 -0
- package/dist/helpers/time.d.ts.map +1 -1
- package/dist/helpers/time.js +6 -0
- package/dist/helpers/time.js.map +1 -1
- package/package.json +13 -7
|
@@ -35,11 +35,18 @@ jobs:
|
|
|
35
35
|
- name: Build
|
|
36
36
|
id: build
|
|
37
37
|
run: ./node_modules/.bin/tsc
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
- uses: JS-DevTools/npm-publish@v1
|
|
39
|
+
with:
|
|
40
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
41
|
+
tag: beta
|
|
42
|
+
access: public
|
|
43
|
+
- name: Publish to Chromatic
|
|
44
|
+
uses: chromaui/action@v1
|
|
45
|
+
# Chromatic GitHub Action options
|
|
46
|
+
with:
|
|
47
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
|
|
49
|
+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
|
43
50
|
- name: Create a release
|
|
44
51
|
id: release
|
|
45
52
|
uses: actions/create-release@v1
|
package/.gitpod.yml
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
vscode:
|
|
2
|
-
extensions:
|
|
3
|
-
- oderwat.indent-rainbow
|
|
4
|
-
- tombonnike.vscode-status-bar-format-toggle
|
|
5
|
-
- usernamehw.errorlens
|
|
6
|
-
- emmanuelbeziat.vscode-great-icons
|
|
7
|
-
- esbenp.prettier-vscode
|
|
8
|
-
- jpoissonnier.vscode-styled-components
|
|
9
|
-
- streetsidesoftware.code-spell-checker
|
|
10
|
-
- foxhoundn.synthax
|
|
11
|
-
- alefragnani.bookmarks
|
|
12
|
-
- tabnine.tabnine-vscode
|
|
13
|
-
- akosyakov.gitpod-monitor
|
|
14
|
-
- eamodio.gitlens
|
|
15
1
|
tasks:
|
|
16
2
|
- init: "yarn install"
|
|
17
3
|
- command: "yarn storybook"
|
|
@@ -1,24 +1,126 @@
|
|
|
1
|
-
import { render } from
|
|
2
|
-
import React from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReqoreButton, ReqoreContent, ReqoreLayoutContent, ReqoreUIProvider } from '../src';
|
|
4
|
+
|
|
5
|
+
test('Renders <Button /> properly', () => {
|
|
6
|
+
render(
|
|
7
|
+
<ReqoreUIProvider>
|
|
8
|
+
<ReqoreLayoutContent>
|
|
9
|
+
<ReqoreContent>
|
|
10
|
+
<ReqoreButton minimal>Hello</ReqoreButton>
|
|
11
|
+
<ReqoreButton icon='4KFill'>Another</ReqoreButton>
|
|
12
|
+
</ReqoreContent>
|
|
13
|
+
</ReqoreLayoutContent>
|
|
14
|
+
</ReqoreUIProvider>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(document.querySelectorAll('.reqore-icon').length).toBe(1);
|
|
18
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(2);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Renders <Button /> with size properly', () => {
|
|
22
|
+
render(
|
|
23
|
+
<ReqoreUIProvider>
|
|
24
|
+
<ReqoreLayoutContent>
|
|
25
|
+
<ReqoreContent>
|
|
26
|
+
<ReqoreButton size='tiny'>Tiny</ReqoreButton>
|
|
27
|
+
<ReqoreButton size='small'>Small</ReqoreButton>
|
|
28
|
+
<ReqoreButton size='big'>Big</ReqoreButton>
|
|
29
|
+
<ReqoreButton size='huge'>Huge</ReqoreButton>
|
|
30
|
+
</ReqoreContent>
|
|
31
|
+
</ReqoreLayoutContent>
|
|
32
|
+
</ReqoreUIProvider>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(4);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Renders <Button /> with icon properly', () => {
|
|
39
|
+
render(
|
|
40
|
+
<ReqoreUIProvider>
|
|
41
|
+
<ReqoreLayoutContent>
|
|
42
|
+
<ReqoreContent>
|
|
43
|
+
<ReqoreButton icon='4KFill'>4K</ReqoreButton>
|
|
44
|
+
<ReqoreButton icon='24HoursFill'>24</ReqoreButton>
|
|
45
|
+
<ReqoreButton icon='BallPenFill'>Pen</ReqoreButton>
|
|
46
|
+
</ReqoreContent>
|
|
47
|
+
</ReqoreLayoutContent>
|
|
48
|
+
</ReqoreUIProvider>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(document.querySelectorAll('.reqore-icon').length).toBe(3);
|
|
52
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(3);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Renders <Button /> with intent properly', () => {
|
|
11
56
|
render(
|
|
12
57
|
<ReqoreUIProvider>
|
|
13
58
|
<ReqoreLayoutContent>
|
|
14
59
|
<ReqoreContent>
|
|
15
|
-
|
|
16
|
-
|
|
60
|
+
<ReqoreButton intent='pending'>Pending</ReqoreButton>
|
|
61
|
+
<ReqoreButton intent='info'>Info</ReqoreButton>
|
|
62
|
+
<ReqoreButton intent='success'>Success</ReqoreButton>
|
|
63
|
+
<ReqoreButton intent='warning'>Warning</ReqoreButton>
|
|
64
|
+
<ReqoreButton intent='danger'>Danger</ReqoreButton>
|
|
65
|
+
</ReqoreContent>
|
|
66
|
+
</ReqoreLayoutContent>
|
|
67
|
+
</ReqoreUIProvider>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(5);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('Renders <Button /> with right icon properly', () => {
|
|
74
|
+
render(
|
|
75
|
+
<ReqoreUIProvider>
|
|
76
|
+
<ReqoreLayoutContent>
|
|
77
|
+
<ReqoreContent>
|
|
78
|
+
<ReqoreButton rightIcon='4KFill'>4K</ReqoreButton>
|
|
79
|
+
<ReqoreButton rightIcon='24HoursFill'>24</ReqoreButton>
|
|
80
|
+
<ReqoreButton rightIcon='BallPenFill'>Pen</ReqoreButton>
|
|
81
|
+
</ReqoreContent>
|
|
82
|
+
</ReqoreLayoutContent>
|
|
83
|
+
</ReqoreUIProvider>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(3);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('Renders <Button /> with icon and right icon properly', () => {
|
|
90
|
+
render(
|
|
91
|
+
<ReqoreUIProvider>
|
|
92
|
+
<ReqoreLayoutContent>
|
|
93
|
+
<ReqoreContent>
|
|
94
|
+
<ReqoreButton icon='4KFill' rightIcon='24HoursFill'>
|
|
95
|
+
4K
|
|
96
|
+
</ReqoreButton>
|
|
97
|
+
<ReqoreButton icon='24HoursFill' rightIcon='BallPenFill'>
|
|
98
|
+
24
|
|
99
|
+
</ReqoreButton>
|
|
100
|
+
<ReqoreButton icon='BallPenFill' rightIcon='4KFill'>
|
|
101
|
+
Pen
|
|
102
|
+
</ReqoreButton>
|
|
103
|
+
</ReqoreContent>
|
|
104
|
+
</ReqoreLayoutContent>
|
|
105
|
+
</ReqoreUIProvider>
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(3);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// A test that tests the onClick function of the button using fireEvent
|
|
112
|
+
test('Renders <Button /> with onClick function', () => {
|
|
113
|
+
const onClick = jest.fn();
|
|
114
|
+
const { getAllByText } = render(
|
|
115
|
+
<ReqoreUIProvider>
|
|
116
|
+
<ReqoreLayoutContent>
|
|
117
|
+
<ReqoreContent>
|
|
118
|
+
<ReqoreButton onClick={onClick}>Click</ReqoreButton>
|
|
17
119
|
</ReqoreContent>
|
|
18
120
|
</ReqoreLayoutContent>
|
|
19
121
|
</ReqoreUIProvider>
|
|
20
122
|
);
|
|
21
123
|
|
|
22
|
-
|
|
23
|
-
expect(
|
|
124
|
+
fireEvent.click(getAllByText('Click')[0]);
|
|
125
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
24
126
|
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { fireEvent, render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ReqoreContent,
|
|
5
|
-
ReqoreDrawer,
|
|
6
|
-
ReqoreLayoutContent,
|
|
7
|
-
ReqoreUIProvider,
|
|
8
|
-
} from '../src';
|
|
3
|
+
import { ReqoreContent, ReqoreDrawer, ReqoreLayoutContent, ReqoreUIProvider } from '../src';
|
|
9
4
|
|
|
10
5
|
test('Does not render <Drawer /> if not open', () => {
|
|
11
6
|
render(
|
package/__tests__/menu.test.tsx
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { fireEvent, render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ReqoreMenu,
|
|
5
|
-
ReqoreMenuDivider,
|
|
6
|
-
ReqoreMenuItem,
|
|
7
|
-
ReqoreUIProvider,
|
|
8
|
-
} from '../src/index';
|
|
3
|
+
import { ReqoreMenu, ReqoreMenuDivider, ReqoreMenuItem, ReqoreUIProvider } from '../src/index';
|
|
9
4
|
|
|
10
5
|
test('Renders <Menu /> properly', () => {
|
|
11
6
|
render(
|
|
@@ -14,13 +9,14 @@ test('Renders <Menu /> properly', () => {
|
|
|
14
9
|
<ReqoreMenuItem> Item 1 </ReqoreMenuItem>
|
|
15
10
|
<ReqoreMenuItem> Item 2 </ReqoreMenuItem>
|
|
16
11
|
<ReqoreMenuDivider label='Divider' />
|
|
12
|
+
<ReqoreMenuItem label={2.5} />
|
|
17
13
|
<ReqoreMenuItem> Item 3 </ReqoreMenuItem>
|
|
18
14
|
<ReqoreMenuItem> Item 4 </ReqoreMenuItem>
|
|
19
15
|
</ReqoreMenu>
|
|
20
16
|
</ReqoreUIProvider>
|
|
21
17
|
);
|
|
22
18
|
|
|
23
|
-
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(
|
|
19
|
+
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(5);
|
|
24
20
|
expect(document.querySelectorAll('.reqore-menu-divider').length).toBe(1);
|
|
25
21
|
});
|
|
26
22
|
|
|
@@ -52,11 +48,7 @@ test('<Menu /> item has right clickable button', () => {
|
|
|
52
48
|
<ReqoreUIProvider>
|
|
53
49
|
<ReqoreMenu>
|
|
54
50
|
<ReqoreMenuItem> Item 1 </ReqoreMenuItem>
|
|
55
|
-
<ReqoreMenuItem
|
|
56
|
-
onClick={itemCb}
|
|
57
|
-
rightIcon='24HoursFill'
|
|
58
|
-
onRightIconClick={iconCb}
|
|
59
|
-
>
|
|
51
|
+
<ReqoreMenuItem onClick={itemCb} rightIcon='24HoursFill' onRightIconClick={iconCb}>
|
|
60
52
|
Item 2
|
|
61
53
|
</ReqoreMenuItem>
|
|
62
54
|
<ReqoreMenuDivider label='Divider' />
|
package/__tests__/tabs.test.tsx
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ReqoreLayoutContent,
|
|
5
|
-
ReqoreTabs,
|
|
6
|
-
ReqoreTabsContent,
|
|
7
|
-
ReqoreUIProvider,
|
|
8
|
-
} from '../src';
|
|
3
|
+
import { ReqoreLayoutContent, ReqoreTabs, ReqoreTabsContent, ReqoreUIProvider } from '../src';
|
|
9
4
|
|
|
10
5
|
test('Renders full <Tabs /> properly', () => {
|
|
11
6
|
render(
|
|
@@ -21,11 +16,11 @@ test('Renders full <Tabs /> properly', () => {
|
|
|
21
16
|
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
22
17
|
]}
|
|
23
18
|
>
|
|
24
|
-
<ReqoreTabsContent
|
|
25
|
-
<ReqoreTabsContent
|
|
26
|
-
<ReqoreTabsContent
|
|
27
|
-
<ReqoreTabsContent
|
|
28
|
-
<ReqoreTabsContent
|
|
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>
|
|
29
24
|
</ReqoreTabs>
|
|
30
25
|
</ReqoreLayoutContent>
|
|
31
26
|
</ReqoreUIProvider>
|
|
@@ -54,11 +49,11 @@ test('Renders shortened <Tabs /> properly', () => {
|
|
|
54
49
|
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
55
50
|
]}
|
|
56
51
|
>
|
|
57
|
-
<ReqoreTabsContent
|
|
58
|
-
<ReqoreTabsContent
|
|
59
|
-
<ReqoreTabsContent
|
|
60
|
-
<ReqoreTabsContent
|
|
61
|
-
<ReqoreTabsContent
|
|
52
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
53
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
54
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
55
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
56
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
62
57
|
</ReqoreTabs>
|
|
63
58
|
</ReqoreLayoutContent>
|
|
64
59
|
</ReqoreUIProvider>
|
|
@@ -66,10 +61,7 @@ test('Renders shortened <Tabs /> properly', () => {
|
|
|
66
61
|
});
|
|
67
62
|
|
|
68
63
|
expect(document.querySelectorAll('.reqore-tabs-list-item').length).toBe(2);
|
|
69
|
-
expect(
|
|
70
|
-
document.querySelectorAll('.reqore-tabs-list .reqore-popover-wrapper')
|
|
71
|
-
.length
|
|
72
|
-
).toBe(1);
|
|
64
|
+
expect(document.querySelectorAll('.reqore-tabs-list .reqore-popover-wrapper').length).toBe(1);
|
|
73
65
|
});
|
|
74
66
|
|
|
75
67
|
test('Default active tab can be specified', () => {
|
|
@@ -87,11 +79,11 @@ test('Default active tab can be specified', () => {
|
|
|
87
79
|
]}
|
|
88
80
|
activeTab='tab4'
|
|
89
81
|
>
|
|
90
|
-
<ReqoreTabsContent
|
|
91
|
-
<ReqoreTabsContent
|
|
92
|
-
<ReqoreTabsContent
|
|
93
|
-
<ReqoreTabsContent
|
|
94
|
-
<ReqoreTabsContent
|
|
82
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
83
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
84
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
85
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
86
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
95
87
|
</ReqoreTabs>
|
|
96
88
|
</ReqoreLayoutContent>
|
|
97
89
|
</ReqoreUIProvider>
|
|
@@ -118,11 +110,11 @@ test('Changes tab and runs callback', () => {
|
|
|
118
110
|
]}
|
|
119
111
|
onTabChange={cb}
|
|
120
112
|
>
|
|
121
|
-
<ReqoreTabsContent
|
|
122
|
-
<ReqoreTabsContent
|
|
123
|
-
<ReqoreTabsContent
|
|
124
|
-
<ReqoreTabsContent
|
|
125
|
-
<ReqoreTabsContent
|
|
113
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
114
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
115
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
116
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
117
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
126
118
|
</ReqoreTabs>
|
|
127
119
|
</ReqoreLayoutContent>
|
|
128
120
|
</ReqoreUIProvider>
|
|
@@ -133,9 +125,7 @@ test('Changes tab and runs callback', () => {
|
|
|
133
125
|
|
|
134
126
|
expect(screen.getByText('Tab 3 content')).toBeTruthy();
|
|
135
127
|
expect(cb).toHaveBeenCalledWith('tab3');
|
|
136
|
-
expect(
|
|
137
|
-
document.querySelectorAll('.reqore-tabs-list-item__active').length
|
|
138
|
-
).toBe(1);
|
|
128
|
+
expect(document.querySelectorAll('.reqore-tabs-list-item__active').length).toBe(1);
|
|
139
129
|
});
|
|
140
130
|
|
|
141
131
|
test('Does not change tab and run callback when disabled', () => {
|
|
@@ -155,11 +145,11 @@ test('Does not change tab and run callback when disabled', () => {
|
|
|
155
145
|
]}
|
|
156
146
|
onTabChange={cb}
|
|
157
147
|
>
|
|
158
|
-
<ReqoreTabsContent
|
|
159
|
-
<ReqoreTabsContent
|
|
160
|
-
<ReqoreTabsContent
|
|
161
|
-
<ReqoreTabsContent
|
|
162
|
-
<ReqoreTabsContent
|
|
148
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
149
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
150
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
151
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
152
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
163
153
|
</ReqoreTabs>
|
|
164
154
|
</ReqoreLayoutContent>
|
|
165
155
|
</ReqoreUIProvider>
|
|
@@ -170,9 +160,7 @@ test('Does not change tab and run callback when disabled', () => {
|
|
|
170
160
|
|
|
171
161
|
expect(screen.getByText('Tab 1 content')).toBeTruthy();
|
|
172
162
|
expect(cb).not.toHaveBeenCalled();
|
|
173
|
-
expect(
|
|
174
|
-
document.querySelectorAll('.reqore-tabs-list-item__active').length
|
|
175
|
-
).toBe(1);
|
|
163
|
+
expect(document.querySelectorAll('.reqore-tabs-list-item__active').length).toBe(1);
|
|
176
164
|
});
|
|
177
165
|
|
|
178
166
|
test('Changes tab programatically and runs callback', () => {
|
|
@@ -195,15 +183,13 @@ test('Changes tab programatically and runs callback', () => {
|
|
|
195
183
|
onTabChange={cb}
|
|
196
184
|
activeTab={activeTab}
|
|
197
185
|
>
|
|
198
|
-
<ReqoreTabsContent
|
|
199
|
-
<button onClick={() => setActiveTab('tab2')}>
|
|
200
|
-
Change active tab
|
|
201
|
-
</button>
|
|
186
|
+
<ReqoreTabsContent tabId='tab1'>
|
|
187
|
+
<button onClick={() => setActiveTab('tab2')}>Change active tab</button>
|
|
202
188
|
</ReqoreTabsContent>
|
|
203
|
-
<ReqoreTabsContent
|
|
204
|
-
<ReqoreTabsContent
|
|
205
|
-
<ReqoreTabsContent
|
|
206
|
-
<ReqoreTabsContent
|
|
189
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
190
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
191
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
192
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
207
193
|
</ReqoreTabs>
|
|
208
194
|
</ReqoreLayoutContent>
|
|
209
195
|
</ReqoreUIProvider>
|
|
@@ -242,11 +228,11 @@ test('Closable tab can be closed if not disabled', () => {
|
|
|
242
228
|
]}
|
|
243
229
|
onTabChange={cb}
|
|
244
230
|
>
|
|
245
|
-
<ReqoreTabsContent
|
|
246
|
-
<ReqoreTabsContent
|
|
247
|
-
<ReqoreTabsContent
|
|
248
|
-
<ReqoreTabsContent
|
|
249
|
-
<ReqoreTabsContent
|
|
231
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
232
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
233
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
234
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
235
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
250
236
|
</ReqoreTabs>
|
|
251
237
|
</ReqoreLayoutContent>
|
|
252
238
|
</ReqoreUIProvider>
|