@zohodesk/components 1.0.0-temp-261 → 1.0.0-temp-262
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/CHANGELOG.md +14 -1
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +20 -0
- package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -1
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +20 -0
- package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +20 -0
- package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/cbt.config.js +1 -0
- package/es/Accordion/__tests__/Accordion.spec.js +117 -3
- package/es/Accordion/__tests__/AccordionItem.spec.js +118 -6
- package/es/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
- package/es/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
- package/es/Animation/__tests__/Animation.spec.js +28 -4
- package/es/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
- package/es/Button/css/Button.module.css +3 -5
- package/es/CheckBox/CheckBox.js +1 -1
- package/es/CheckBox/CheckBox.module.css +1 -1
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
- package/es/DateTime/DateTime.module.css +2 -2
- package/es/DateTime/__tests__/CalendarView.spec.js +70 -3
- package/es/DateTime/__tests__/DateTime.spec.js +89 -6
- package/es/DateTime/__tests__/DateTimePopupFooter.spec.js +20 -2
- package/es/DateTime/__tests__/DateTimePopupHeader.spec.js +29 -2
- package/es/DateTime/__tests__/DateWidget.spec.js +34 -2
- package/es/DateTime/__tests__/DaysRow.spec.js +19 -3
- package/es/DateTime/__tests__/Time.spec.js +50 -3
- package/es/DateTime/__tests__/YearView.spec.js +60 -3
- package/es/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +265 -1
- package/es/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
- package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
- package/es/DividerLine/css/DividerLine.module.css +1 -2
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +1 -4
- package/es/Heading/Heading.module.css +1 -1
- package/es/Heading/__tests__/Heading.spec.js +57 -3
- package/es/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
- package/es/ListItem/ListItem.module.css +1 -2
- package/es/ListItem/__tests__/ListContainer.spec.js +228 -1
- package/es/ListItem/__tests__/ListItem.spec.js +359 -1
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +390 -1
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +214 -1
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +303 -1
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +230 -1
- package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
- package/es/MultiSelect/MultiSelect.module.css +1 -2
- package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +671 -1
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +730 -1
- package/es/MultiSelect/__tests__/EmptyState.spec.js +268 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +889 -2
- package/es/MultiSelect/__tests__/MultiSelectHeader.spec.js +50 -1
- package/es/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +487 -1
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +291 -1
- package/es/MultiSelect/__tests__/Suggestions.spec.js +370 -2
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11785 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12083 -0
- package/es/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14052 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
- package/es/PopOver/__tests__/PopOver.spec.js +141 -2
- package/es/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
- package/es/Radio/Radio.module.css +1 -1
- package/es/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +212 -1
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
- package/es/Tab/Tab.module.css +1 -2
- package/es/Tab/Tabs.module.css +1 -2
- package/es/Tab/__tests__/Tab.spec.js +249 -1
- package/es/Tab/__tests__/TabContent.spec.js +34 -1
- package/es/Tab/__tests__/TabContentWrapper.spec.js +72 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +163 -1
- package/es/Tab/__tests__/Tabs.spec.js +681 -1
- package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
- package/es/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
- package/es/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
- package/es/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
- package/es/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
- package/es/Textarea/Textarea.module.css +1 -1
- package/es/Tooltip/Tooltip.module.css +1 -2
- package/es/Tooltip/__tests__/Tooltip.spec.js +590 -0
- package/es/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
- package/es/Typography/__tests__/Typography.spec.js +1 -1
- package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +0 -40
- package/es/Typography/css/Typography.module.css +9 -16
- package/es/Typography/props/propTypes.js +1 -1
- package/es/common/common.module.css +4 -4
- package/es/index.d.ts +39 -0
- package/es/index.js +12 -12
- package/es/semantic/Button/semanticButton.module.css +1 -2
- package/es/v1/Button/css/Button_v1.module.css +0 -1
- package/es/v1/Switch/css/Switch_v1.module.css +2 -3
- package/es/v1/Tab/Tab.js +150 -0
- package/es/v1/Tab/TabList.js +145 -0
- package/es/v1/Tab/TabMoreMenu.js +245 -0
- package/es/v1/Tab/TabPanel.js +51 -0
- package/es/v1/Tab/Tabs.js +125 -0
- package/es/v1/Tab/__tests__/Tab.spec.js +824 -0
- package/es/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4684 -0
- package/es/v1/Tab/constants/index.js +105 -0
- package/es/v1/Tab/constants/presets.js +22 -0
- package/es/v1/Tab/context.js +19 -0
- package/es/v1/Tab/core/Tab.js +60 -0
- package/es/v1/Tab/core/TabList.js +51 -0
- package/es/v1/Tab/core/TabListFocusScope.js +18 -0
- package/es/v1/Tab/core/TabPanel.js +54 -0
- package/es/v1/Tab/core/Tabs.js +45 -0
- package/es/v1/Tab/core/index.js +6 -0
- package/es/v1/Tab/css/Tab_v1.module.css +369 -0
- package/es/v1/Tab/css/cssJSLogic.js +1 -0
- package/es/v1/Tab/css/tab.cva.js +163 -0
- package/es/v1/Tab/index.js +8 -0
- package/es/v1/Tab/props/defaultProps.js +55 -0
- package/es/v1/Tab/props/propTypes.js +215 -0
- package/es/v1/Tab/utils/pinSelectedTab.js +44 -0
- package/lib/Accordion/__tests__/Accordion.spec.js +122 -2
- package/lib/Accordion/__tests__/AccordionItem.spec.js +126 -4
- package/lib/Accordion/__tests__/__snapshots__/Accordion.spec.js.snap +344 -2
- package/lib/Accordion/__tests__/__snapshots__/AccordionItem.spec.js.snap +155 -3
- package/lib/Animation/__tests__/Animation.spec.js +31 -5
- package/lib/Animation/__tests__/__snapshots__/Animation.spec.js.snap +92 -2
- package/lib/Button/css/Button.module.css +3 -5
- package/lib/CheckBox/CheckBox.js +1 -1
- package/lib/CheckBox/CheckBox.module.css +1 -1
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1 -1
- package/lib/DateTime/DateTime.module.css +2 -2
- package/lib/DateTime/__tests__/CalendarView.spec.js +71 -2
- package/lib/DateTime/__tests__/DateTime.spec.js +92 -6
- package/lib/DateTime/__tests__/DateTimePopupFooter.spec.js +21 -1
- package/lib/DateTime/__tests__/DateTimePopupHeader.spec.js +30 -1
- package/lib/DateTime/__tests__/DateWidget.spec.js +35 -1
- package/lib/DateTime/__tests__/DaysRow.spec.js +20 -2
- package/lib/DateTime/__tests__/Time.spec.js +51 -2
- package/lib/DateTime/__tests__/YearView.spec.js +61 -2
- package/lib/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +2907 -170
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +4392 -108
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +67 -1
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +187 -1
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +265 -1
- package/lib/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +155 -2
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +522 -5
- package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +540 -0
- package/lib/DividerLine/css/DividerLine.module.css +1 -2
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +1 -4
- package/lib/Heading/Heading.module.css +1 -1
- package/lib/Heading/__tests__/Heading.spec.js +60 -4
- package/lib/Heading/__tests__/__snapshots__/Heading.spec.js.snap +87 -14
- package/lib/ListItem/ListItem.module.css +1 -2
- package/lib/ListItem/__tests__/ListContainer.spec.js +229 -0
- package/lib/ListItem/__tests__/ListItem.spec.js +362 -0
- package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +391 -0
- package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +215 -0
- package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +304 -0
- package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +231 -0
- package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +602 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1807 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +2703 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +2909 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +2009 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +3070 -0
- package/lib/MultiSelect/MultiSelect.module.css +1 -2
- package/lib/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +692 -0
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +741 -0
- package/lib/MultiSelect/__tests__/EmptyState.spec.js +273 -0
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +910 -0
- package/lib/MultiSelect/__tests__/MultiSelectHeader.spec.js +51 -0
- package/lib/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +497 -0
- package/lib/MultiSelect/__tests__/SelectedOptions.spec.js +305 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +375 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +11785 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +12083 -0
- package/lib/MultiSelect/__tests__/__snapshots__/EmptyState.spec.js.snap +253 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +14052 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +136 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +11506 -0
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +1382 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +3611 -0
- package/lib/PopOver/__tests__/PopOver.spec.js +150 -1
- package/lib/PopOver/__tests__/__snapshots__/PopOver.spec.js.snap +1260 -0
- package/lib/Radio/Radio.module.css +1 -1
- package/lib/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +213 -0
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1802 -0
- package/lib/Tab/Tab.module.css +1 -2
- package/lib/Tab/Tabs.module.css +1 -2
- package/lib/Tab/__tests__/Tab.spec.js +250 -0
- package/lib/Tab/__tests__/TabContent.spec.js +35 -0
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +76 -0
- package/lib/Tab/__tests__/TabWrapper.spec.js +174 -0
- package/lib/Tab/__tests__/Tabs.spec.js +741 -0
- package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +1049 -0
- package/lib/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +99 -0
- package/lib/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +121 -0
- package/lib/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +2002 -0
- package/lib/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +11053 -0
- package/lib/Textarea/Textarea.module.css +1 -1
- package/lib/Tooltip/Tooltip.module.css +1 -2
- package/lib/Tooltip/__tests__/Tooltip.spec.js +629 -0
- package/lib/Tooltip/__tests__/__snapshots__/Tooltip.spec.js.snap +813 -0
- package/lib/Typography/__tests__/Typography.spec.js +1 -1
- package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +0 -40
- package/lib/Typography/css/Typography.module.css +9 -16
- package/lib/Typography/props/propTypes.js +1 -1
- package/lib/common/common.module.css +4 -4
- package/lib/index.d.ts +39 -0
- package/lib/index.js +270 -173
- package/lib/semantic/Button/semanticButton.module.css +1 -2
- package/lib/v1/Button/css/Button_v1.module.css +0 -1
- package/lib/v1/Switch/css/Switch_v1.module.css +2 -3
- package/lib/v1/Tab/Tab.js +171 -0
- package/lib/v1/Tab/TabList.js +180 -0
- package/lib/v1/Tab/TabMoreMenu.js +284 -0
- package/lib/v1/Tab/TabPanel.js +64 -0
- package/lib/v1/Tab/Tabs.js +151 -0
- package/lib/v1/Tab/__tests__/Tab.spec.js +913 -0
- package/lib/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4684 -0
- package/lib/v1/Tab/constants/index.js +109 -0
- package/lib/v1/Tab/constants/presets.js +31 -0
- package/lib/v1/Tab/context.js +30 -0
- package/lib/v1/Tab/core/Tab.js +88 -0
- package/lib/v1/Tab/core/TabList.js +82 -0
- package/lib/v1/Tab/core/TabListFocusScope.js +28 -0
- package/lib/v1/Tab/core/TabPanel.js +85 -0
- package/lib/v1/Tab/core/Tabs.js +63 -0
- package/lib/v1/Tab/core/index.js +109 -0
- package/lib/v1/Tab/css/Tab_v1.module.css +369 -0
- package/lib/v1/Tab/css/cssJSLogic.js +25 -0
- package/lib/v1/Tab/css/tab.cva.js +173 -0
- package/lib/v1/Tab/index.js +141 -0
- package/lib/v1/Tab/props/defaultProps.js +69 -0
- package/lib/v1/Tab/props/propTypes.js +240 -0
- package/lib/v1/Tab/utils/pinSelectedTab.js +59 -0
- package/package.json +18 -15
- package/tsconfig.jest.json +5 -0
- package/tsconfig.json +9 -0
- package/ut.config.js +2 -1
package/es/Tab/Tab.module.css
CHANGED
package/es/Tab/Tabs.module.css
CHANGED
|
@@ -133,8 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.emptyStateTitle {
|
|
136
|
-
composes: d-text-center from global;
|
|
137
|
-
font-weight: var(--zd-fw-semibold);
|
|
136
|
+
composes: d-text-center d-font-semibold from global;
|
|
138
137
|
word-wrap: break-word;
|
|
139
138
|
font-size: var(--zd_font_size16) ;
|
|
140
139
|
max-width: var(--zd_size430) ;
|
|
@@ -1,11 +1,259 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
3
|
import Tab from "../Tab";
|
|
4
4
|
describe('Tab', () => {
|
|
5
|
+
afterEach(() => cleanup());
|
|
5
6
|
test('rendering the defult props', () => {
|
|
6
7
|
const {
|
|
7
8
|
asFragment
|
|
8
9
|
} = render( /*#__PURE__*/React.createElement(Tab, null));
|
|
9
10
|
expect(asFragment()).toMatchSnapshot();
|
|
10
11
|
});
|
|
12
|
+
const types = ['alpha', 'beta', 'delta'];
|
|
13
|
+
const titlePositions = ['top', 'bottom', 'right', 'left'];
|
|
14
|
+
const contentAligns = ['left', 'right', 'vertical', 'horizontal', 'top', 'bottom', 'between', 'around', 'baseline'];
|
|
15
|
+
const contentAlignBoxes = ['column', 'row-reverse', 'column-reverse']; // the appearance classes are applied only when needAppearance is set, so type cases pair with it
|
|
16
|
+
|
|
17
|
+
test.each(types)('Render with needAppearance and type as %s', type => {
|
|
18
|
+
const {
|
|
19
|
+
asFragment
|
|
20
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
21
|
+
needAppearance: true,
|
|
22
|
+
type: type
|
|
23
|
+
}));
|
|
24
|
+
expect(asFragment()).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
test.each(types)('Render with isActive, needAppearance and type as %s', type => {
|
|
27
|
+
const {
|
|
28
|
+
asFragment
|
|
29
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
30
|
+
isActive: true,
|
|
31
|
+
needAppearance: true,
|
|
32
|
+
type: type
|
|
33
|
+
}));
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
test.each(types)('Render with isActive, needAppearance, needBorder and type as %s', type => {
|
|
37
|
+
const {
|
|
38
|
+
asFragment
|
|
39
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
40
|
+
isActive: true,
|
|
41
|
+
needAppearance: true,
|
|
42
|
+
needBorder: true,
|
|
43
|
+
type: type
|
|
44
|
+
}));
|
|
45
|
+
expect(asFragment()).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
test.each(titlePositions)('Render with title and titlePosition as %s', titlePosition => {
|
|
48
|
+
const {
|
|
49
|
+
asFragment
|
|
50
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
51
|
+
title: "Tab title",
|
|
52
|
+
titlePosition: titlePosition
|
|
53
|
+
}));
|
|
54
|
+
expect(asFragment()).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
test.each(contentAligns)('Render with contentAlign as %s', contentAlign => {
|
|
57
|
+
const {
|
|
58
|
+
asFragment
|
|
59
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
60
|
+
contentAlign: contentAlign
|
|
61
|
+
}));
|
|
62
|
+
expect(asFragment()).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
test.each(contentAlignBoxes)('Render with contentAlignBox as %s', contentAlignBox => {
|
|
65
|
+
const {
|
|
66
|
+
asFragment
|
|
67
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
68
|
+
contentAlignBox: contentAlignBox
|
|
69
|
+
}));
|
|
70
|
+
expect(asFragment()).toMatchSnapshot();
|
|
71
|
+
});
|
|
72
|
+
test('Render with id', () => {
|
|
73
|
+
const {
|
|
74
|
+
asFragment
|
|
75
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
76
|
+
id: "tab1"
|
|
77
|
+
}));
|
|
78
|
+
expect(asFragment()).toMatchSnapshot();
|
|
79
|
+
});
|
|
80
|
+
test('Render with text', () => {
|
|
81
|
+
const {
|
|
82
|
+
asFragment
|
|
83
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
84
|
+
text: "Tab text"
|
|
85
|
+
}));
|
|
86
|
+
expect(asFragment()).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
test('Render with children as string', () => {
|
|
89
|
+
const {
|
|
90
|
+
asFragment
|
|
91
|
+
} = render( /*#__PURE__*/React.createElement(Tab, null, "Tab child"));
|
|
92
|
+
expect(asFragment()).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
test('Render with children as element', () => {
|
|
95
|
+
const {
|
|
96
|
+
asFragment
|
|
97
|
+
} = render( /*#__PURE__*/React.createElement(Tab, null, /*#__PURE__*/React.createElement("span", null, "Tab child")));
|
|
98
|
+
expect(asFragment()).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
test('Render with text and children', () => {
|
|
101
|
+
const {
|
|
102
|
+
asFragment
|
|
103
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
104
|
+
text: "Tab text"
|
|
105
|
+
}, /*#__PURE__*/React.createElement("span", null, "Tab child")));
|
|
106
|
+
expect(asFragment()).toMatchSnapshot();
|
|
107
|
+
});
|
|
108
|
+
test('Render with tourId', () => {
|
|
109
|
+
const {
|
|
110
|
+
asFragment
|
|
111
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
112
|
+
tourId: "tab-tour"
|
|
113
|
+
}));
|
|
114
|
+
expect(asFragment()).toMatchSnapshot();
|
|
115
|
+
});
|
|
116
|
+
test('Render with dataId and dataSelectorId', () => {
|
|
117
|
+
const {
|
|
118
|
+
asFragment
|
|
119
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
120
|
+
dataId: "tab-dataId",
|
|
121
|
+
dataSelectorId: "tab-dataSelectorId"
|
|
122
|
+
}));
|
|
123
|
+
expect(asFragment()).toMatchSnapshot();
|
|
124
|
+
});
|
|
125
|
+
test('Render with className', () => {
|
|
126
|
+
const {
|
|
127
|
+
asFragment
|
|
128
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
129
|
+
className: "custom-tab"
|
|
130
|
+
}));
|
|
131
|
+
expect(asFragment()).toMatchSnapshot();
|
|
132
|
+
});
|
|
133
|
+
test('Render with style', () => {
|
|
134
|
+
const {
|
|
135
|
+
asFragment
|
|
136
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
137
|
+
style: {
|
|
138
|
+
width: '100px'
|
|
139
|
+
}
|
|
140
|
+
}));
|
|
141
|
+
expect(asFragment()).toMatchSnapshot();
|
|
142
|
+
});
|
|
143
|
+
test('Render with isDisabled', () => {
|
|
144
|
+
const {
|
|
145
|
+
asFragment
|
|
146
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
147
|
+
isDisabled: true
|
|
148
|
+
}));
|
|
149
|
+
expect(asFragment()).toMatchSnapshot();
|
|
150
|
+
});
|
|
151
|
+
test('Render with isLink and href', () => {
|
|
152
|
+
const {
|
|
153
|
+
asFragment
|
|
154
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
155
|
+
isLink: true,
|
|
156
|
+
href: "/tab"
|
|
157
|
+
}));
|
|
158
|
+
expect(asFragment()).toMatchSnapshot();
|
|
159
|
+
});
|
|
160
|
+
test('Render with isLink without href', () => {
|
|
161
|
+
const {
|
|
162
|
+
asFragment
|
|
163
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
164
|
+
isLink: true
|
|
165
|
+
}));
|
|
166
|
+
expect(asFragment()).toMatchSnapshot();
|
|
167
|
+
});
|
|
168
|
+
test('Render with href without isLink', () => {
|
|
169
|
+
const {
|
|
170
|
+
asFragment
|
|
171
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
172
|
+
href: "/tab"
|
|
173
|
+
}));
|
|
174
|
+
expect(asFragment()).toMatchSnapshot();
|
|
175
|
+
});
|
|
176
|
+
test('Render with align as vertical', () => {
|
|
177
|
+
const {
|
|
178
|
+
asFragment
|
|
179
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
180
|
+
align: "vertical"
|
|
181
|
+
}));
|
|
182
|
+
expect(asFragment()).toMatchSnapshot();
|
|
183
|
+
});
|
|
184
|
+
test('Render with isActive', () => {
|
|
185
|
+
const {
|
|
186
|
+
asFragment
|
|
187
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
188
|
+
isActive: true
|
|
189
|
+
}));
|
|
190
|
+
expect(asFragment()).toMatchSnapshot();
|
|
191
|
+
});
|
|
192
|
+
test('Render with needAppearance', () => {
|
|
193
|
+
const {
|
|
194
|
+
asFragment
|
|
195
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
196
|
+
needAppearance: true
|
|
197
|
+
}));
|
|
198
|
+
expect(asFragment()).toMatchSnapshot();
|
|
199
|
+
});
|
|
200
|
+
test('Render with needAppearance and needBorder', () => {
|
|
201
|
+
const {
|
|
202
|
+
asFragment
|
|
203
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
204
|
+
needAppearance: true,
|
|
205
|
+
needBorder: true
|
|
206
|
+
}));
|
|
207
|
+
expect(asFragment()).toMatchSnapshot();
|
|
208
|
+
});
|
|
209
|
+
test('Render with isActive, needAppearance and needBorder', () => {
|
|
210
|
+
const {
|
|
211
|
+
asFragment
|
|
212
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
213
|
+
isActive: true,
|
|
214
|
+
needAppearance: true,
|
|
215
|
+
needBorder: true
|
|
216
|
+
}));
|
|
217
|
+
expect(asFragment()).toMatchSnapshot();
|
|
218
|
+
}); // isAnimate suppresses the active border, which only exists for a typed tab
|
|
219
|
+
|
|
220
|
+
test('Render with isActive, needAppearance, needBorder, isAnimate and type as alpha', () => {
|
|
221
|
+
const {
|
|
222
|
+
asFragment
|
|
223
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
224
|
+
isActive: true,
|
|
225
|
+
needAppearance: true,
|
|
226
|
+
needBorder: true,
|
|
227
|
+
isAnimate: true,
|
|
228
|
+
type: "alpha"
|
|
229
|
+
}));
|
|
230
|
+
expect(asFragment()).toMatchSnapshot();
|
|
231
|
+
});
|
|
232
|
+
test('Render with isActive and activeClass', () => {
|
|
233
|
+
const {
|
|
234
|
+
asFragment
|
|
235
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
236
|
+
isActive: true,
|
|
237
|
+
activeClass: "custom-active-tab"
|
|
238
|
+
}));
|
|
239
|
+
expect(asFragment()).toMatchSnapshot();
|
|
240
|
+
});
|
|
241
|
+
test('Render with activeClass without isActive', () => {
|
|
242
|
+
const {
|
|
243
|
+
asFragment
|
|
244
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
245
|
+
activeClass: "custom-active-tab"
|
|
246
|
+
}));
|
|
247
|
+
expect(asFragment()).toMatchSnapshot();
|
|
248
|
+
});
|
|
249
|
+
test('Render with customProps', () => {
|
|
250
|
+
const {
|
|
251
|
+
asFragment
|
|
252
|
+
} = render( /*#__PURE__*/React.createElement(Tab, {
|
|
253
|
+
customProps: {
|
|
254
|
+
'data-custom-attr': 'true'
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
257
|
+
expect(asFragment()).toMatchSnapshot();
|
|
258
|
+
});
|
|
11
259
|
});
|
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
3
|
import TabContent from "../TabContent";
|
|
4
4
|
describe('TabContent', () => {
|
|
5
|
+
afterEach(() => cleanup());
|
|
5
6
|
test('rendering the defult props', () => {
|
|
6
7
|
const {
|
|
7
8
|
asFragment
|
|
8
9
|
} = render( /*#__PURE__*/React.createElement(TabContent, null, /*#__PURE__*/React.createElement("div", null, "Test")));
|
|
9
10
|
expect(asFragment()).toMatchSnapshot();
|
|
10
11
|
});
|
|
12
|
+
const scrolls = ['vertical', 'horizontal', 'both', 'none'];
|
|
13
|
+
test('Render with no children', () => {
|
|
14
|
+
const {
|
|
15
|
+
asFragment
|
|
16
|
+
} = render( /*#__PURE__*/React.createElement(TabContent, null));
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
test.each(scrolls)('Render with scroll as %s', scroll => {
|
|
20
|
+
const {
|
|
21
|
+
asFragment
|
|
22
|
+
} = render( /*#__PURE__*/React.createElement(TabContent, {
|
|
23
|
+
scroll: scroll
|
|
24
|
+
}));
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
test('Render with id', () => {
|
|
28
|
+
const {
|
|
29
|
+
asFragment
|
|
30
|
+
} = render( /*#__PURE__*/React.createElement(TabContent, {
|
|
31
|
+
id: "tab-content-id"
|
|
32
|
+
}));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('Render with dataId and dataSelectorId', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = render( /*#__PURE__*/React.createElement(TabContent, {
|
|
39
|
+
dataId: "tab-content-dataId",
|
|
40
|
+
dataSelectorId: "tab-content-dataSelectorId"
|
|
41
|
+
}));
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
43
|
+
});
|
|
11
44
|
});
|
|
@@ -1,11 +1,82 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
3
|
import TabContentWrapper from "../TabContentWrapper";
|
|
4
|
+
import TabContent from "../TabContent"; // the wrapper keeps only the child whose id equals selectedTab, so cases use real TabContent children
|
|
5
|
+
|
|
6
|
+
const renderTabContentWrapper = props => render( /*#__PURE__*/React.createElement(TabContentWrapper, props, /*#__PURE__*/React.createElement(TabContent, {
|
|
7
|
+
id: "page1"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("div", null, "Page 1 Content")), /*#__PURE__*/React.createElement(TabContent, {
|
|
9
|
+
id: "page2"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("div", null, "Page 2 Content"))));
|
|
11
|
+
|
|
4
12
|
describe('TabContentWrapper', () => {
|
|
13
|
+
afterEach(() => cleanup());
|
|
5
14
|
test('rendering the defult props', () => {
|
|
6
15
|
const {
|
|
7
16
|
asFragment
|
|
8
17
|
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, null));
|
|
9
18
|
expect(asFragment()).toMatchSnapshot();
|
|
10
19
|
});
|
|
20
|
+
test.each(['page1', 'page2'])('Render with selectedTab as %s', selectedTab => {
|
|
21
|
+
const {
|
|
22
|
+
asFragment
|
|
23
|
+
} = renderTabContentWrapper({
|
|
24
|
+
selectedTab
|
|
25
|
+
});
|
|
26
|
+
expect(asFragment()).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
test('Render with selectedTab not matching any child', () => {
|
|
29
|
+
const {
|
|
30
|
+
asFragment
|
|
31
|
+
} = renderTabContentWrapper({
|
|
32
|
+
selectedTab: 'page3'
|
|
33
|
+
});
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
test('Render with className', () => {
|
|
37
|
+
const {
|
|
38
|
+
asFragment
|
|
39
|
+
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, {
|
|
40
|
+
className: "custom-wrapper"
|
|
41
|
+
}));
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
test('Render with style', () => {
|
|
45
|
+
const {
|
|
46
|
+
asFragment
|
|
47
|
+
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, {
|
|
48
|
+
style: {
|
|
49
|
+
height: '100px'
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
expect(asFragment()).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
test('Render with dataId and dataSelectorId', () => {
|
|
55
|
+
const {
|
|
56
|
+
asFragment
|
|
57
|
+
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, {
|
|
58
|
+
dataId: "tab-content-wrapper-dataId",
|
|
59
|
+
dataSelectorId: "tab-content-wrapper-dataSelectorId"
|
|
60
|
+
}));
|
|
61
|
+
expect(asFragment()).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
test('Render with tagName as section', () => {
|
|
64
|
+
const {
|
|
65
|
+
asFragment
|
|
66
|
+
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, {
|
|
67
|
+
tagName: "section"
|
|
68
|
+
}));
|
|
69
|
+
expect(asFragment()).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
test('Render with a11y', () => {
|
|
72
|
+
const {
|
|
73
|
+
asFragment
|
|
74
|
+
} = render( /*#__PURE__*/React.createElement(TabContentWrapper, {
|
|
75
|
+
a11y: {
|
|
76
|
+
role: 'region',
|
|
77
|
+
'aria-label': 'Tab panels'
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
expect(asFragment()).toMatchSnapshot();
|
|
81
|
+
});
|
|
11
82
|
});
|
|
@@ -1,11 +1,173 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
3
|
import TabWrapper from "../TabWrapper";
|
|
4
|
+
import Tabs from "../Tabs";
|
|
5
|
+
import Tab from "../Tab";
|
|
6
|
+
import TabContentWrapper from "../TabContentWrapper";
|
|
7
|
+
import TabContent from "../TabContent"; // TabWrapper clones its props into its children, so cases use the real Tabs and TabContentWrapper;
|
|
8
|
+
// isResponsive is off because Tabs would otherwise collapse every tab into the more menu at 0 width
|
|
9
|
+
|
|
10
|
+
const renderTabWrapper = props => render( /*#__PURE__*/React.createElement(TabWrapper, props, /*#__PURE__*/React.createElement(Tabs, {
|
|
11
|
+
isResponsive: false
|
|
12
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
13
|
+
id: "page1",
|
|
14
|
+
text: "Page 1"
|
|
15
|
+
}), /*#__PURE__*/React.createElement(Tab, {
|
|
16
|
+
id: "page2",
|
|
17
|
+
text: "Page 2"
|
|
18
|
+
})), /*#__PURE__*/React.createElement(TabContentWrapper, null, /*#__PURE__*/React.createElement(TabContent, {
|
|
19
|
+
id: "page1"
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", null, "Page 1 Content")), /*#__PURE__*/React.createElement(TabContent, {
|
|
21
|
+
id: "page2"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", null, "Page 2 Content")))));
|
|
23
|
+
|
|
4
24
|
describe('TabWrapper', () => {
|
|
25
|
+
afterEach(() => cleanup());
|
|
5
26
|
test('rendering the defult props', () => {
|
|
6
27
|
const {
|
|
7
28
|
asFragment
|
|
8
29
|
} = render( /*#__PURE__*/React.createElement(TabWrapper, null, /*#__PURE__*/React.createElement("div", null, "Test")));
|
|
9
30
|
expect(asFragment()).toMatchSnapshot();
|
|
31
|
+
}); // vertical is the default align and beta/delta are non-default types
|
|
32
|
+
|
|
33
|
+
const aligns = ['horizontal', 'vertical-reverse', 'horizontal-reverse'];
|
|
34
|
+
const types = ['beta', 'delta'];
|
|
35
|
+
test('Render with tabs and content', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = renderTabWrapper();
|
|
39
|
+
expect(asFragment()).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
test.each(['page1', 'page2'])('Render with defaultTab as %s', defaultTab => {
|
|
42
|
+
const {
|
|
43
|
+
asFragment
|
|
44
|
+
} = renderTabWrapper({
|
|
45
|
+
defaultTab
|
|
46
|
+
});
|
|
47
|
+
expect(asFragment()).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
test.each(aligns)('Render with defaultTab and align as %s', align => {
|
|
50
|
+
const {
|
|
51
|
+
asFragment
|
|
52
|
+
} = renderTabWrapper({
|
|
53
|
+
defaultTab: 'page1',
|
|
54
|
+
align
|
|
55
|
+
});
|
|
56
|
+
expect(asFragment()).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
test.each(types)('Render with defaultTab and type as %s', type => {
|
|
59
|
+
const {
|
|
60
|
+
asFragment
|
|
61
|
+
} = renderTabWrapper({
|
|
62
|
+
defaultTab: 'page1',
|
|
63
|
+
type
|
|
64
|
+
});
|
|
65
|
+
expect(asFragment()).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
test('Render with needBorder=false', () => {
|
|
68
|
+
const {
|
|
69
|
+
asFragment
|
|
70
|
+
} = renderTabWrapper({
|
|
71
|
+
needBorder: false
|
|
72
|
+
});
|
|
73
|
+
expect(asFragment()).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
test('Render with needPadding=false', () => {
|
|
76
|
+
const {
|
|
77
|
+
asFragment
|
|
78
|
+
} = renderTabWrapper({
|
|
79
|
+
needPadding: false
|
|
80
|
+
});
|
|
81
|
+
expect(asFragment()).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
test('Render with needAppearance=false', () => {
|
|
84
|
+
const {
|
|
85
|
+
asFragment
|
|
86
|
+
} = renderTabWrapper({
|
|
87
|
+
defaultTab: 'page1',
|
|
88
|
+
needAppearance: false
|
|
89
|
+
});
|
|
90
|
+
expect(asFragment()).toMatchSnapshot();
|
|
91
|
+
}); // the highlight line renders only when isAnimate, needTabBorder and needAppearance are all set
|
|
92
|
+
|
|
93
|
+
test('Render with needTabBorder', () => {
|
|
94
|
+
const {
|
|
95
|
+
asFragment
|
|
96
|
+
} = renderTabWrapper({
|
|
97
|
+
defaultTab: 'page1',
|
|
98
|
+
needTabBorder: true
|
|
99
|
+
});
|
|
100
|
+
expect(asFragment()).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
test('Render with isAnimate and needTabBorder', () => {
|
|
103
|
+
const {
|
|
104
|
+
asFragment
|
|
105
|
+
} = renderTabWrapper({
|
|
106
|
+
defaultTab: 'page1',
|
|
107
|
+
isAnimate: true,
|
|
108
|
+
needTabBorder: true
|
|
109
|
+
});
|
|
110
|
+
expect(asFragment()).toMatchSnapshot();
|
|
111
|
+
});
|
|
112
|
+
test('Render with isAnimate, needTabBorder and needAppearance=false', () => {
|
|
113
|
+
const {
|
|
114
|
+
asFragment
|
|
115
|
+
} = renderTabWrapper({
|
|
116
|
+
defaultTab: 'page1',
|
|
117
|
+
isAnimate: true,
|
|
118
|
+
needTabBorder: true,
|
|
119
|
+
needAppearance: false
|
|
120
|
+
});
|
|
121
|
+
expect(asFragment()).toMatchSnapshot();
|
|
122
|
+
});
|
|
123
|
+
test('Render with dataId and dataSelectorId', () => {
|
|
124
|
+
const {
|
|
125
|
+
asFragment
|
|
126
|
+
} = renderTabWrapper({
|
|
127
|
+
dataId: 'tab-wrapper-dataId',
|
|
128
|
+
dataSelectorId: 'tab-wrapper-dataSelectorId'
|
|
129
|
+
});
|
|
130
|
+
expect(asFragment()).toMatchSnapshot();
|
|
131
|
+
});
|
|
132
|
+
test('Render with only tabs', () => {
|
|
133
|
+
const {
|
|
134
|
+
asFragment
|
|
135
|
+
} = render( /*#__PURE__*/React.createElement(TabWrapper, {
|
|
136
|
+
defaultTab: "page1"
|
|
137
|
+
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
138
|
+
isResponsive: false
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Tab, {
|
|
140
|
+
id: "page1",
|
|
141
|
+
text: "Page 1"
|
|
142
|
+
}))));
|
|
143
|
+
expect(asFragment()).toMatchSnapshot();
|
|
144
|
+
}); // hookToDisableInternalState only differs from the default after a selection, so these cases click a tab
|
|
145
|
+
|
|
146
|
+
test('Render with a tab selected after the first render', () => {
|
|
147
|
+
const onSelect = jest.fn();
|
|
148
|
+
const {
|
|
149
|
+
asFragment,
|
|
150
|
+
getByText
|
|
151
|
+
} = renderTabWrapper({
|
|
152
|
+
defaultTab: 'page1',
|
|
153
|
+
onSelect
|
|
154
|
+
});
|
|
155
|
+
fireEvent.click(getByText('Page 2'));
|
|
156
|
+
expect(onSelect).toHaveBeenCalledWith('page2');
|
|
157
|
+
expect(asFragment()).toMatchSnapshot();
|
|
158
|
+
});
|
|
159
|
+
test('Render with hookToDisableInternalState after selecting another tab', () => {
|
|
160
|
+
const onSelect = jest.fn();
|
|
161
|
+
const {
|
|
162
|
+
asFragment,
|
|
163
|
+
getByText
|
|
164
|
+
} = renderTabWrapper({
|
|
165
|
+
defaultTab: 'page1',
|
|
166
|
+
hookToDisableInternalState: true,
|
|
167
|
+
onSelect
|
|
168
|
+
});
|
|
169
|
+
fireEvent.click(getByText('Page 2'));
|
|
170
|
+
expect(onSelect).toHaveBeenCalledWith('page2');
|
|
171
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
172
|
});
|
|
11
173
|
});
|