@zohodesk/components 1.0.0-temp-149 → 1.0.0-temp-150
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/README.md +1195 -1191
- package/assets/Appearance/dark/mode/darkMode.module.css +2 -2
- package/assets/Appearance/default/mode/defaultMode.module.css +2 -2
- package/assets/Appearance/pureDark/mode/pureDarkMode.module.css +2 -2
- package/assets/Contrast/darkContrastLightness.module.css +0 -2
- package/assets/Contrast/defaultContrastLightness.module.css +0 -2
- package/assets/Contrast/pureDarkContrastLightness.module.css +0 -2
- package/es/AppContainer/AppContainer.module.css +18 -18
- package/es/Avatar/Avatar.js +9 -9
- package/es/Avatar/Avatar.module.css +175 -175
- package/es/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
- package/es/AvatarTeam/AvatarTeam.js +7 -7
- package/es/AvatarTeam/AvatarTeam.module.css +188 -188
- package/es/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
- package/es/Button/Button.js +48 -51
- package/es/Button/{Button.module.css → css/Button.module.css} +525 -543
- package/es/Button/css/cssJSLogic.js +53 -0
- package/es/Button/index.js +2 -0
- package/es/Button/props/propTypes.js +3 -1
- package/es/Buttongroup/Buttongroup.js +1 -1
- package/es/Buttongroup/Buttongroup.module.css +106 -106
- package/es/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
- package/es/Card/Card.js +4 -4
- package/es/Card/Card.module.css +20 -20
- package/es/CheckBox/CheckBox.js +0 -0
- package/es/CheckBox/CheckBox.module.css +157 -157
- package/es/DateTime/CalendarView.js +0 -0
- package/es/DateTime/DateTime.js +5 -25
- package/es/DateTime/DateTime.module.css +235 -235
- package/es/DateTime/DateWidget.js +0 -0
- package/es/DateTime/DateWidget.module.css +38 -38
- package/es/DateTime/YearView.js +0 -0
- package/es/DateTime/YearView.module.css +98 -98
- package/es/DateTime/common.js +0 -0
- package/es/DateTime/dateFormatUtils/dateFormats.js +3 -2
- package/es/DateTime/dateFormatUtils/index.js +27 -0
- package/es/DateTime/index.js +0 -0
- package/es/DateTime/objectUtils.js +0 -0
- package/es/DateTime/typeChecker.js +0 -0
- package/es/DateTime/validator.js +0 -0
- package/es/DropBox/DropBox.js +3 -5
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +427 -427
- package/es/DropBox/DropBoxPositionMapping.json +144 -144
- package/es/DropBox/css/DropBox.module.css +58 -58
- package/es/DropDown/DropDown.js +0 -0
- package/es/DropDown/DropDown.module.css +5 -5
- package/es/DropDown/DropDownHeading.js +0 -0
- package/es/DropDown/DropDownHeading.module.css +53 -53
- package/es/DropDown/DropDownItem.js +0 -0
- package/es/DropDown/DropDownItem.module.css +94 -94
- package/es/DropDown/DropDownSearch.js +0 -0
- package/es/DropDown/DropDownSearch.module.css +14 -14
- package/es/DropDown/DropDownSeparator.js +0 -0
- package/es/DropDown/DropDownSeparator.module.css +7 -7
- package/es/Heading/Heading.module.css +4 -4
- package/es/Label/Label.js +2 -2
- package/es/Label/Label.module.css +52 -52
- package/es/Label/LabelColors.module.css +20 -20
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
- package/es/Layout/Box.js +0 -0
- package/es/Layout/Container.js +0 -0
- package/es/Layout/Layout.module.css +335 -335
- package/es/Layout/utils.js +0 -0
- package/es/ListItem/ListItem.js +0 -0
- package/es/ListItem/ListItem.module.css +216 -216
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +5 -5
- package/es/MultiSelect/AdvancedMultiSelect.js +0 -2
- package/es/MultiSelect/MultiSelect.js +5 -8
- package/es/MultiSelect/MultiSelect.module.css +205 -205
- package/es/MultiSelect/MultiSelectWithAvatar.js +0 -0
- package/es/MultiSelect/SelectedOptions.module.css +15 -15
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
- package/es/PopOver/PopOver.module.css +8 -8
- package/es/Popup/Popup.js +2 -3
- package/es/Popup/PositionMapping.json +73 -73
- package/es/Radio/Radio.js +0 -0
- package/es/Radio/Radio.module.css +112 -112
- package/es/Responsive/CustomResponsive.js +0 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
- package/es/Ribbon/Ribbon.js +0 -0
- package/es/Ribbon/Ribbon.module.css +454 -454
- package/es/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
- package/es/RippleEffect/RippleEffect.module.css +92 -92
- package/es/Select/GroupSelect.js +0 -0
- package/es/Select/Select.js +0 -0
- package/es/Select/Select.module.css +108 -108
- package/es/Select/SelectWithAvatar.js +0 -0
- package/es/Select/SelectWithIcon.js +0 -0
- package/es/Select/__tests__/Select.spec.js +0 -0
- package/es/Stencils/Stencils.js +0 -0
- package/es/Stencils/Stencils.module.css +96 -96
- package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
- package/es/Switch/Switch.js +0 -0
- package/es/Switch/Switch.module.css +127 -127
- package/es/Tab/Tab.module.css +100 -100
- package/es/Tab/TabContent.module.css +4 -4
- package/es/Tab/Tabs.js +19 -19
- package/es/Tab/Tabs.module.css +143 -143
- package/es/Tag/Tag.js +8 -8
- package/es/Tag/Tag.module.css +254 -254
- package/es/Text/Text.js +37 -0
- package/es/Text/Text.module.css +21 -0
- package/es/Text/props/defaultProps.js +7 -0
- package/es/Text/props/propTypes.js +11 -0
- package/es/TextBox/TextBox.js +0 -0
- package/es/TextBox/TextBox.module.css +157 -157
- package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
- package/es/TextBoxIcon/TextBoxIcon.js +0 -0
- package/es/TextBoxIcon/TextBoxIcon.module.css +78 -78
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
- package/es/Textarea/Textarea.js +0 -0
- package/es/Textarea/Textarea.module.css +139 -139
- package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
- package/es/Tooltip/Tooltip.module.css +133 -133
- package/es/common/a11y.module.css +3 -3
- package/es/common/animation.module.css +624 -624
- package/es/common/avatarsizes.module.css +48 -48
- package/es/common/basic.module.css +33 -33
- package/es/common/basicReset.module.css +40 -40
- package/es/common/boxShadow.module.css +33 -33
- package/es/common/common.module.css +524 -524
- package/es/common/customscroll.module.css +89 -89
- package/es/common/reset.module.css +12 -12
- package/es/common/transition.module.css +146 -146
- package/es/deprecated/AdvancedMultiSelect.module.css +126 -126
- package/es/index.js +2 -1
- package/es/semantic/Button/semanticButton.module.css +9 -9
- package/es/utils/Common.js +4 -0
- package/es/utils/dropDownUtils.js +0 -0
- package/install.md +10 -10
- package/lib/AppContainer/AppContainer.module.css +18 -18
- package/lib/Avatar/Avatar.js +9 -9
- package/lib/Avatar/Avatar.module.css +175 -175
- package/lib/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
- package/lib/AvatarTeam/AvatarTeam.js +7 -7
- package/lib/AvatarTeam/AvatarTeam.module.css +188 -188
- package/lib/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
- package/lib/Button/Button.js +47 -76
- package/lib/Button/{Button.module.css → css/Button.module.css} +525 -543
- package/lib/Button/css/cssJSLogic.js +40 -0
- package/lib/Button/index.js +20 -0
- package/lib/Button/props/propTypes.js +5 -2
- package/lib/Buttongroup/Buttongroup.js +1 -1
- package/lib/Buttongroup/Buttongroup.module.css +106 -106
- package/lib/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
- package/lib/Card/Card.js +4 -4
- package/lib/Card/Card.module.css +20 -20
- package/lib/CheckBox/CheckBox.js +0 -0
- package/lib/CheckBox/CheckBox.module.css +157 -157
- package/lib/DateTime/CalendarView.js +0 -0
- package/lib/DateTime/DateTime.js +5 -24
- package/lib/DateTime/DateTime.module.css +235 -235
- package/lib/DateTime/DateTimePopupFooter.js +1 -1
- package/lib/DateTime/DateTimePopupHeader.js +1 -1
- package/lib/DateTime/DateWidget.js +1 -1
- package/lib/DateTime/DateWidget.module.css +38 -38
- package/lib/DateTime/DaysRow.js +1 -1
- package/lib/DateTime/Time.js +1 -1
- package/lib/DateTime/YearView.js +1 -1
- package/lib/DateTime/YearView.module.css +98 -98
- package/lib/DateTime/common.js +0 -0
- package/lib/DateTime/dateFormatUtils/dateFormats.js +3 -2
- package/lib/DateTime/dateFormatUtils/index.js +31 -3
- package/lib/DateTime/dateFormatUtils/timeChange.js +1 -1
- package/lib/DateTime/index.js +0 -0
- package/lib/DateTime/objectUtils.js +0 -0
- package/lib/DateTime/typeChecker.js +0 -0
- package/lib/DateTime/validator.js +0 -0
- package/lib/DropBox/DropBox.js +3 -5
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +427 -427
- package/lib/DropBox/DropBoxPositionMapping.json +144 -144
- package/lib/DropBox/css/DropBox.module.css +58 -58
- package/lib/DropDown/DropDown.js +0 -0
- package/lib/DropDown/DropDown.module.css +5 -5
- package/lib/DropDown/DropDownHeading.js +0 -0
- package/lib/DropDown/DropDownHeading.module.css +53 -53
- package/lib/DropDown/DropDownItem.js +0 -0
- package/lib/DropDown/DropDownItem.module.css +94 -94
- package/lib/DropDown/DropDownSearch.js +0 -0
- package/lib/DropDown/DropDownSearch.module.css +14 -14
- package/lib/DropDown/DropDownSeparator.js +0 -0
- package/lib/DropDown/DropDownSeparator.module.css +7 -7
- package/lib/Heading/Heading.module.css +4 -4
- package/lib/Label/Label.js +3 -1
- package/lib/Label/Label.module.css +52 -52
- package/lib/Label/LabelColors.module.css +20 -20
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
- package/lib/Layout/Box.js +0 -0
- package/lib/Layout/Container.js +0 -0
- package/lib/Layout/Layout.module.css +335 -335
- package/lib/Layout/utils.js +0 -0
- package/lib/ListItem/ListContainer.js +1 -1
- package/lib/ListItem/ListItem.js +1 -1
- package/lib/ListItem/ListItem.module.css +216 -216
- package/lib/ListItem/ListItemWithAvatar.js +1 -1
- package/lib/ListItem/ListItemWithIcon.js +1 -1
- package/lib/Modal/Modal.js +1 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +6 -6
- package/lib/MultiSelect/AdvancedMultiSelect.js +1 -3
- package/lib/MultiSelect/EmptyState.js +1 -1
- package/lib/MultiSelect/MultiSelect.js +6 -9
- package/lib/MultiSelect/MultiSelect.module.css +205 -205
- package/lib/MultiSelect/MultiSelectHeader.js +1 -1
- package/lib/MultiSelect/MultiSelectWithAvatar.js +1 -1
- package/lib/MultiSelect/SelectedOptions.js +1 -1
- package/lib/MultiSelect/SelectedOptions.module.css +15 -15
- package/lib/MultiSelect/Suggestions.js +1 -1
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
- package/lib/PopOver/PopOver.module.css +8 -8
- package/lib/Popup/Popup.js +2 -3
- package/lib/Popup/PositionMapping.json +73 -73
- package/lib/Popup/__tests__/Popup.spec.js +1 -1
- package/lib/Radio/Radio.js +1 -1
- package/lib/Radio/Radio.module.css +112 -112
- package/lib/Responsive/CustomResponsive.js +0 -1
- package/lib/Responsive/ResizeComponent.js +3 -1
- package/lib/Responsive/Responsive.js +1 -1
- package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
- package/lib/Ribbon/Ribbon.js +1 -1
- package/lib/Ribbon/Ribbon.module.css +454 -454
- package/lib/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
- package/lib/RippleEffect/RippleEffect.module.css +92 -92
- package/lib/Select/GroupSelect.js +1 -1
- package/lib/Select/Select.js +1 -2
- package/lib/Select/Select.module.css +108 -108
- package/lib/Select/SelectWithAvatar.js +1 -1
- package/lib/Select/SelectWithIcon.js +1 -1
- package/lib/Select/__tests__/Select.spec.js +1 -1
- package/lib/Stencils/Stencils.js +1 -1
- package/lib/Stencils/Stencils.module.css +96 -96
- package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
- package/lib/Switch/Switch.js +0 -0
- package/lib/Switch/Switch.module.css +127 -127
- package/lib/Tab/Tab.js +1 -1
- package/lib/Tab/Tab.module.css +100 -100
- package/lib/Tab/TabContent.module.css +4 -4
- package/lib/Tab/Tabs.js +19 -13
- package/lib/Tab/Tabs.module.css +143 -143
- package/lib/Tag/Tag.js +8 -8
- package/lib/Tag/Tag.module.css +254 -254
- package/lib/Text/Text.js +65 -0
- package/lib/Text/Text.module.css +21 -0
- package/lib/Text/props/defaultProps.js +14 -0
- package/lib/Text/props/propTypes.js +19 -0
- package/lib/TextBox/TextBox.js +1 -1
- package/lib/TextBox/TextBox.module.css +157 -157
- package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
- package/lib/TextBoxIcon/TextBoxIcon.js +0 -0
- package/lib/TextBoxIcon/TextBoxIcon.module.css +78 -78
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +0 -1
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
- package/lib/Textarea/Textarea.js +1 -1
- package/lib/Textarea/Textarea.module.css +139 -139
- package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
- package/lib/Tooltip/Tooltip.module.css +133 -133
- package/lib/common/a11y.module.css +3 -3
- package/lib/common/animation.module.css +624 -624
- package/lib/common/avatarsizes.module.css +48 -48
- package/lib/common/basic.module.css +33 -33
- package/lib/common/basicReset.module.css +40 -40
- package/lib/common/boxShadow.module.css +33 -33
- package/lib/common/common.module.css +524 -524
- package/lib/common/customscroll.module.css +89 -89
- package/lib/common/reset.module.css +12 -12
- package/lib/common/transition.module.css +146 -146
- package/lib/deprecated/AdvancedMultiSelect.module.css +126 -126
- package/lib/deprecated/PortalLayer/PortalLayer.js +1 -1
- package/lib/index.js +9 -1
- package/lib/semantic/Button/semanticButton.module.css +9 -9
- package/lib/utils/Common.js +7 -1
- package/lib/utils/dropDownUtils.js +1 -1
- package/package.json +102 -102
- package/es/Button/__tests__/Button.spec.js +0 -190
- package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
- package/lib/Button/__tests__/Button.spec.js +0 -193
- package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from '../Button';
|
|
3
|
-
import TestUtils from 'react-dom/test-utils';
|
|
4
|
-
import renderer from 'react-test-renderer';
|
|
5
|
-
describe('Button component', () => {
|
|
6
|
-
it('should display text', () => {
|
|
7
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
8
|
-
text: "primary",
|
|
9
|
-
palette: "primary"
|
|
10
|
-
}));
|
|
11
|
-
expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp').textContent.contains('primary')).toBe(true);
|
|
12
|
-
});
|
|
13
|
-
it('should be able to click', () => {
|
|
14
|
-
let mockfn = jest.fn();
|
|
15
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
16
|
-
text: "primary",
|
|
17
|
-
palette: "primary",
|
|
18
|
-
onClick: mockfn
|
|
19
|
-
}));
|
|
20
|
-
let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
21
|
-
TestUtils.Simulate.click(buttonEle);
|
|
22
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
23
|
-
});
|
|
24
|
-
it('should not able to click', () => {
|
|
25
|
-
let mockfn = jest.fn();
|
|
26
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
27
|
-
text: "primary",
|
|
28
|
-
palette: "primary",
|
|
29
|
-
onClick: mockfn,
|
|
30
|
-
disabled: true
|
|
31
|
-
}));
|
|
32
|
-
let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp_disabled');
|
|
33
|
-
TestUtils.Simulate.click(buttonEle);
|
|
34
|
-
expect(mockfn.mock.calls.length).toBe(0);
|
|
35
|
-
});
|
|
36
|
-
it('should not able to click on loading status', () => {
|
|
37
|
-
let mockfn = jest.fn();
|
|
38
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
39
|
-
text: "primary",
|
|
40
|
-
palette: "primary",
|
|
41
|
-
onClick: mockfn,
|
|
42
|
-
status: "loading"
|
|
43
|
-
}));
|
|
44
|
-
let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
45
|
-
TestUtils.Simulate.click(buttonEle);
|
|
46
|
-
expect(mockfn.mock.calls.length).toBe(0);
|
|
47
|
-
});
|
|
48
|
-
it('should able to click other than loading status', () => {
|
|
49
|
-
let mockfn = jest.fn();
|
|
50
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
51
|
-
text: "primary",
|
|
52
|
-
palette: "primary",
|
|
53
|
-
onClick: mockfn,
|
|
54
|
-
status: "success"
|
|
55
|
-
}));
|
|
56
|
-
let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
57
|
-
TestUtils.Simulate.click(buttonEle);
|
|
58
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
59
|
-
});
|
|
60
|
-
it('should able to click and click arguments should be event object', () => {
|
|
61
|
-
let mockfn = jest.fn();
|
|
62
|
-
let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
|
|
63
|
-
text: "primary",
|
|
64
|
-
palette: "primary",
|
|
65
|
-
onClick: mockfn,
|
|
66
|
-
status: "success"
|
|
67
|
-
}));
|
|
68
|
-
let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
69
|
-
TestUtils.Simulate.click(buttonEle);
|
|
70
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
71
|
-
expect(mockfn.mock.calls[0].length).toBe(1);
|
|
72
|
-
});
|
|
73
|
-
it('should the palette is plainPrimary', () => {
|
|
74
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
75
|
-
text: "primary",
|
|
76
|
-
palette: "plainPrimary"
|
|
77
|
-
}));
|
|
78
|
-
let tree = ele.toJSON();
|
|
79
|
-
expect(tree).toMatchSnapshot();
|
|
80
|
-
});
|
|
81
|
-
it('should the palette is plainSecondary', () => {
|
|
82
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
83
|
-
text: "plainSecondary",
|
|
84
|
-
palette: "plainSecondary"
|
|
85
|
-
}));
|
|
86
|
-
let tree = ele.toJSON();
|
|
87
|
-
expect(tree).toMatchSnapshot();
|
|
88
|
-
});
|
|
89
|
-
it('should the palette is primaryFilled', () => {
|
|
90
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
91
|
-
text: "primaryFilled",
|
|
92
|
-
palette: "primaryFilled"
|
|
93
|
-
}));
|
|
94
|
-
let tree = ele.toJSON();
|
|
95
|
-
expect(tree).toMatchSnapshot();
|
|
96
|
-
});
|
|
97
|
-
it('should the palette is danger', () => {
|
|
98
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
99
|
-
text: "danger",
|
|
100
|
-
palette: "danger"
|
|
101
|
-
}));
|
|
102
|
-
let tree = ele.toJSON();
|
|
103
|
-
expect(tree).toMatchSnapshot();
|
|
104
|
-
});
|
|
105
|
-
it('should the palette is dangerFilled', () => {
|
|
106
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
107
|
-
text: "dangerFilled",
|
|
108
|
-
palette: "dangerFilled"
|
|
109
|
-
}));
|
|
110
|
-
let tree = ele.toJSON();
|
|
111
|
-
expect(tree).toMatchSnapshot();
|
|
112
|
-
});
|
|
113
|
-
it('should the palette is secondary', () => {
|
|
114
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
115
|
-
text: "secondary",
|
|
116
|
-
palette: "secondary"
|
|
117
|
-
}));
|
|
118
|
-
let tree = ele.toJSON();
|
|
119
|
-
expect(tree).toMatchSnapshot();
|
|
120
|
-
});
|
|
121
|
-
it('should the palette is secondaryFilled', () => {
|
|
122
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
123
|
-
text: "secondaryFilled",
|
|
124
|
-
palette: "secondaryFilled"
|
|
125
|
-
}));
|
|
126
|
-
let tree = ele.toJSON();
|
|
127
|
-
expect(tree).toMatchSnapshot();
|
|
128
|
-
});
|
|
129
|
-
it('should is not bold', () => {
|
|
130
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
131
|
-
text: "secondaryFilled",
|
|
132
|
-
isBold: false
|
|
133
|
-
}));
|
|
134
|
-
let tree = ele.toJSON();
|
|
135
|
-
expect(tree).toMatchSnapshot();
|
|
136
|
-
});
|
|
137
|
-
it('should is rounded', () => {
|
|
138
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
139
|
-
text: "secondaryFilled",
|
|
140
|
-
rounded: true
|
|
141
|
-
}));
|
|
142
|
-
let tree = ele.toJSON();
|
|
143
|
-
expect(tree).toMatchSnapshot();
|
|
144
|
-
});
|
|
145
|
-
it('should the size is small', () => {
|
|
146
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
147
|
-
text: "small",
|
|
148
|
-
rounded: true,
|
|
149
|
-
size: "small"
|
|
150
|
-
}));
|
|
151
|
-
let tree = ele.toJSON();
|
|
152
|
-
expect(tree).toMatchSnapshot();
|
|
153
|
-
});
|
|
154
|
-
it('should the size is large', () => {
|
|
155
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
156
|
-
text: "large",
|
|
157
|
-
rounded: true,
|
|
158
|
-
size: "large"
|
|
159
|
-
}));
|
|
160
|
-
let tree = ele.toJSON();
|
|
161
|
-
expect(tree).toMatchSnapshot();
|
|
162
|
-
});
|
|
163
|
-
it('should the size is xlarge', () => {
|
|
164
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
165
|
-
text: "xlarge",
|
|
166
|
-
rounded: true,
|
|
167
|
-
size: "xlarge"
|
|
168
|
-
}));
|
|
169
|
-
let tree = ele.toJSON();
|
|
170
|
-
expect(tree).toMatchSnapshot();
|
|
171
|
-
});
|
|
172
|
-
it('should the status is loading', () => {
|
|
173
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
174
|
-
text: "secondaryFilled",
|
|
175
|
-
rounded: true,
|
|
176
|
-
status: "loading"
|
|
177
|
-
}));
|
|
178
|
-
let tree = ele.toJSON();
|
|
179
|
-
expect(tree).toMatchSnapshot();
|
|
180
|
-
});
|
|
181
|
-
it('should the status is success', () => {
|
|
182
|
-
let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
|
|
183
|
-
text: "secondaryFilled",
|
|
184
|
-
rounded: true,
|
|
185
|
-
status: "success"
|
|
186
|
-
}));
|
|
187
|
-
let tree = ele.toJSON();
|
|
188
|
-
expect(tree).toMatchSnapshot();
|
|
189
|
-
});
|
|
190
|
-
});
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Button component should is not bold 1`] = `
|
|
4
|
-
<button
|
|
5
|
-
className=" primary medium "
|
|
6
|
-
data-id="buttonComp"
|
|
7
|
-
disabled={false}
|
|
8
|
-
onClick={[Function]}
|
|
9
|
-
type="button"
|
|
10
|
-
>
|
|
11
|
-
secondaryFilled
|
|
12
|
-
</button>
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`Button component should is rounded 1`] = `
|
|
16
|
-
<button
|
|
17
|
-
className=" primary rounded medium bold "
|
|
18
|
-
data-id="buttonComp"
|
|
19
|
-
disabled={false}
|
|
20
|
-
onClick={[Function]}
|
|
21
|
-
type="button"
|
|
22
|
-
>
|
|
23
|
-
secondaryFilled
|
|
24
|
-
</button>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`Button component should the palette is danger 1`] = `
|
|
28
|
-
<button
|
|
29
|
-
className=" danger medium bold "
|
|
30
|
-
data-id="buttonComp"
|
|
31
|
-
disabled={false}
|
|
32
|
-
onClick={[Function]}
|
|
33
|
-
type="button"
|
|
34
|
-
>
|
|
35
|
-
danger
|
|
36
|
-
</button>
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
exports[`Button component should the palette is dangerFilled 1`] = `
|
|
40
|
-
<button
|
|
41
|
-
className=" dangerfilled medium bold "
|
|
42
|
-
data-id="buttonComp"
|
|
43
|
-
disabled={false}
|
|
44
|
-
onClick={[Function]}
|
|
45
|
-
type="button"
|
|
46
|
-
>
|
|
47
|
-
dangerFilled
|
|
48
|
-
</button>
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`Button component should the palette is plainPrimary 1`] = `
|
|
52
|
-
<button
|
|
53
|
-
className=" plainprimary medium bold "
|
|
54
|
-
data-id="buttonComp"
|
|
55
|
-
disabled={false}
|
|
56
|
-
onClick={[Function]}
|
|
57
|
-
type="button"
|
|
58
|
-
>
|
|
59
|
-
primary
|
|
60
|
-
</button>
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
exports[`Button component should the palette is plainSecondary 1`] = `
|
|
64
|
-
<button
|
|
65
|
-
className=" plainsecondary medium bold "
|
|
66
|
-
data-id="buttonComp"
|
|
67
|
-
disabled={false}
|
|
68
|
-
onClick={[Function]}
|
|
69
|
-
type="button"
|
|
70
|
-
>
|
|
71
|
-
plainSecondary
|
|
72
|
-
</button>
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
exports[`Button component should the palette is primaryFilled 1`] = `
|
|
76
|
-
<button
|
|
77
|
-
className=" primaryfilled medium bold "
|
|
78
|
-
data-id="buttonComp"
|
|
79
|
-
disabled={false}
|
|
80
|
-
onClick={[Function]}
|
|
81
|
-
type="button"
|
|
82
|
-
>
|
|
83
|
-
primaryFilled
|
|
84
|
-
</button>
|
|
85
|
-
`;
|
|
86
|
-
|
|
87
|
-
exports[`Button component should the palette is secondary 1`] = `
|
|
88
|
-
<button
|
|
89
|
-
className=" secondary medium bold "
|
|
90
|
-
data-id="buttonComp"
|
|
91
|
-
disabled={false}
|
|
92
|
-
onClick={[Function]}
|
|
93
|
-
type="button"
|
|
94
|
-
>
|
|
95
|
-
secondary
|
|
96
|
-
</button>
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
exports[`Button component should the palette is secondaryFilled 1`] = `
|
|
100
|
-
<button
|
|
101
|
-
className=" secondaryfilled medium bold "
|
|
102
|
-
data-id="buttonComp"
|
|
103
|
-
disabled={false}
|
|
104
|
-
onClick={[Function]}
|
|
105
|
-
type="button"
|
|
106
|
-
>
|
|
107
|
-
secondaryFilled
|
|
108
|
-
</button>
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
exports[`Button component should the size is large 1`] = `
|
|
112
|
-
<button
|
|
113
|
-
className=" primary rounded large bold "
|
|
114
|
-
data-id="buttonComp"
|
|
115
|
-
disabled={false}
|
|
116
|
-
onClick={[Function]}
|
|
117
|
-
type="button"
|
|
118
|
-
>
|
|
119
|
-
large
|
|
120
|
-
</button>
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
exports[`Button component should the size is small 1`] = `
|
|
124
|
-
<button
|
|
125
|
-
className=" primary rounded small bold "
|
|
126
|
-
data-id="buttonComp"
|
|
127
|
-
disabled={false}
|
|
128
|
-
onClick={[Function]}
|
|
129
|
-
type="button"
|
|
130
|
-
>
|
|
131
|
-
small
|
|
132
|
-
</button>
|
|
133
|
-
`;
|
|
134
|
-
|
|
135
|
-
exports[`Button component should the size is xlarge 1`] = `
|
|
136
|
-
<button
|
|
137
|
-
className=" primary rounded xlarge bold "
|
|
138
|
-
data-id="buttonComp"
|
|
139
|
-
disabled={false}
|
|
140
|
-
onClick={[Function]}
|
|
141
|
-
type="button"
|
|
142
|
-
>
|
|
143
|
-
xlarge
|
|
144
|
-
</button>
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
exports[`Button component should the status is loading 1`] = `
|
|
148
|
-
<button
|
|
149
|
-
className=" primary rounded medium bold "
|
|
150
|
-
data-id="buttonComp"
|
|
151
|
-
disabled={true}
|
|
152
|
-
onClick={[Function]}
|
|
153
|
-
type="button"
|
|
154
|
-
>
|
|
155
|
-
secondaryFilled
|
|
156
|
-
<div
|
|
157
|
-
className="overlay"
|
|
158
|
-
>
|
|
159
|
-
<div
|
|
160
|
-
className="loading"
|
|
161
|
-
>
|
|
162
|
-
<div
|
|
163
|
-
className="element"
|
|
164
|
-
/>
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
</button>
|
|
168
|
-
`;
|
|
169
|
-
|
|
170
|
-
exports[`Button component should the status is success 1`] = `
|
|
171
|
-
<button
|
|
172
|
-
className=" primary rounded medium bold "
|
|
173
|
-
data-id="buttonComp"
|
|
174
|
-
disabled={false}
|
|
175
|
-
onClick={[Function]}
|
|
176
|
-
type="button"
|
|
177
|
-
>
|
|
178
|
-
secondaryFilled
|
|
179
|
-
<div
|
|
180
|
-
className="overlay"
|
|
181
|
-
>
|
|
182
|
-
<div
|
|
183
|
-
className="success"
|
|
184
|
-
>
|
|
185
|
-
<div
|
|
186
|
-
className="element"
|
|
187
|
-
/>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
</button>
|
|
191
|
-
`;
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
var _Button = _interopRequireDefault(require("../Button"));
|
|
5
|
-
var _testUtils = _interopRequireDefault(require("react-dom/test-utils"));
|
|
6
|
-
var _reactTestRenderer = _interopRequireDefault(require("react-test-renderer"));
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
describe('Button component', function () {
|
|
9
|
-
it('should display text', function () {
|
|
10
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
11
|
-
text: "primary",
|
|
12
|
-
palette: "primary"
|
|
13
|
-
}));
|
|
14
|
-
expect(_testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp').textContent.contains('primary')).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
it('should be able to click', function () {
|
|
17
|
-
var mockfn = jest.fn();
|
|
18
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
19
|
-
text: "primary",
|
|
20
|
-
palette: "primary",
|
|
21
|
-
onClick: mockfn
|
|
22
|
-
}));
|
|
23
|
-
var buttonEle = _testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
24
|
-
_testUtils["default"].Simulate.click(buttonEle);
|
|
25
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
26
|
-
});
|
|
27
|
-
it('should not able to click', function () {
|
|
28
|
-
var mockfn = jest.fn();
|
|
29
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
30
|
-
text: "primary",
|
|
31
|
-
palette: "primary",
|
|
32
|
-
onClick: mockfn,
|
|
33
|
-
disabled: true
|
|
34
|
-
}));
|
|
35
|
-
var buttonEle = _testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp_disabled');
|
|
36
|
-
_testUtils["default"].Simulate.click(buttonEle);
|
|
37
|
-
expect(mockfn.mock.calls.length).toBe(0);
|
|
38
|
-
});
|
|
39
|
-
it('should not able to click on loading status', function () {
|
|
40
|
-
var mockfn = jest.fn();
|
|
41
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
42
|
-
text: "primary",
|
|
43
|
-
palette: "primary",
|
|
44
|
-
onClick: mockfn,
|
|
45
|
-
status: "loading"
|
|
46
|
-
}));
|
|
47
|
-
var buttonEle = _testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
48
|
-
_testUtils["default"].Simulate.click(buttonEle);
|
|
49
|
-
expect(mockfn.mock.calls.length).toBe(0);
|
|
50
|
-
});
|
|
51
|
-
it('should able to click other than loading status', function () {
|
|
52
|
-
var mockfn = jest.fn();
|
|
53
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
54
|
-
text: "primary",
|
|
55
|
-
palette: "primary",
|
|
56
|
-
onClick: mockfn,
|
|
57
|
-
status: "success"
|
|
58
|
-
}));
|
|
59
|
-
var buttonEle = _testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
60
|
-
_testUtils["default"].Simulate.click(buttonEle);
|
|
61
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
62
|
-
});
|
|
63
|
-
it('should able to click and click arguments should be event object', function () {
|
|
64
|
-
var mockfn = jest.fn();
|
|
65
|
-
var renderedDOM = _testUtils["default"].renderIntoDocument( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
66
|
-
text: "primary",
|
|
67
|
-
palette: "primary",
|
|
68
|
-
onClick: mockfn,
|
|
69
|
-
status: "success"
|
|
70
|
-
}));
|
|
71
|
-
var buttonEle = _testUtils["default"].findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
|
|
72
|
-
_testUtils["default"].Simulate.click(buttonEle);
|
|
73
|
-
expect(mockfn.mock.calls.length).toBe(1);
|
|
74
|
-
expect(mockfn.mock.calls[0].length).toBe(1);
|
|
75
|
-
});
|
|
76
|
-
it('should the palette is plainPrimary', function () {
|
|
77
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
78
|
-
text: "primary",
|
|
79
|
-
palette: "plainPrimary"
|
|
80
|
-
}));
|
|
81
|
-
var tree = ele.toJSON();
|
|
82
|
-
expect(tree).toMatchSnapshot();
|
|
83
|
-
});
|
|
84
|
-
it('should the palette is plainSecondary', function () {
|
|
85
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
86
|
-
text: "plainSecondary",
|
|
87
|
-
palette: "plainSecondary"
|
|
88
|
-
}));
|
|
89
|
-
var tree = ele.toJSON();
|
|
90
|
-
expect(tree).toMatchSnapshot();
|
|
91
|
-
});
|
|
92
|
-
it('should the palette is primaryFilled', function () {
|
|
93
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
94
|
-
text: "primaryFilled",
|
|
95
|
-
palette: "primaryFilled"
|
|
96
|
-
}));
|
|
97
|
-
var tree = ele.toJSON();
|
|
98
|
-
expect(tree).toMatchSnapshot();
|
|
99
|
-
});
|
|
100
|
-
it('should the palette is danger', function () {
|
|
101
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
102
|
-
text: "danger",
|
|
103
|
-
palette: "danger"
|
|
104
|
-
}));
|
|
105
|
-
var tree = ele.toJSON();
|
|
106
|
-
expect(tree).toMatchSnapshot();
|
|
107
|
-
});
|
|
108
|
-
it('should the palette is dangerFilled', function () {
|
|
109
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
110
|
-
text: "dangerFilled",
|
|
111
|
-
palette: "dangerFilled"
|
|
112
|
-
}));
|
|
113
|
-
var tree = ele.toJSON();
|
|
114
|
-
expect(tree).toMatchSnapshot();
|
|
115
|
-
});
|
|
116
|
-
it('should the palette is secondary', function () {
|
|
117
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
118
|
-
text: "secondary",
|
|
119
|
-
palette: "secondary"
|
|
120
|
-
}));
|
|
121
|
-
var tree = ele.toJSON();
|
|
122
|
-
expect(tree).toMatchSnapshot();
|
|
123
|
-
});
|
|
124
|
-
it('should the palette is secondaryFilled', function () {
|
|
125
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
126
|
-
text: "secondaryFilled",
|
|
127
|
-
palette: "secondaryFilled"
|
|
128
|
-
}));
|
|
129
|
-
var tree = ele.toJSON();
|
|
130
|
-
expect(tree).toMatchSnapshot();
|
|
131
|
-
});
|
|
132
|
-
it('should is not bold', function () {
|
|
133
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
134
|
-
text: "secondaryFilled",
|
|
135
|
-
isBold: false
|
|
136
|
-
}));
|
|
137
|
-
var tree = ele.toJSON();
|
|
138
|
-
expect(tree).toMatchSnapshot();
|
|
139
|
-
});
|
|
140
|
-
it('should is rounded', function () {
|
|
141
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
142
|
-
text: "secondaryFilled",
|
|
143
|
-
rounded: true
|
|
144
|
-
}));
|
|
145
|
-
var tree = ele.toJSON();
|
|
146
|
-
expect(tree).toMatchSnapshot();
|
|
147
|
-
});
|
|
148
|
-
it('should the size is small', function () {
|
|
149
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
150
|
-
text: "small",
|
|
151
|
-
rounded: true,
|
|
152
|
-
size: "small"
|
|
153
|
-
}));
|
|
154
|
-
var tree = ele.toJSON();
|
|
155
|
-
expect(tree).toMatchSnapshot();
|
|
156
|
-
});
|
|
157
|
-
it('should the size is large', function () {
|
|
158
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
159
|
-
text: "large",
|
|
160
|
-
rounded: true,
|
|
161
|
-
size: "large"
|
|
162
|
-
}));
|
|
163
|
-
var tree = ele.toJSON();
|
|
164
|
-
expect(tree).toMatchSnapshot();
|
|
165
|
-
});
|
|
166
|
-
it('should the size is xlarge', function () {
|
|
167
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
168
|
-
text: "xlarge",
|
|
169
|
-
rounded: true,
|
|
170
|
-
size: "xlarge"
|
|
171
|
-
}));
|
|
172
|
-
var tree = ele.toJSON();
|
|
173
|
-
expect(tree).toMatchSnapshot();
|
|
174
|
-
});
|
|
175
|
-
it('should the status is loading', function () {
|
|
176
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
177
|
-
text: "secondaryFilled",
|
|
178
|
-
rounded: true,
|
|
179
|
-
status: "loading"
|
|
180
|
-
}));
|
|
181
|
-
var tree = ele.toJSON();
|
|
182
|
-
expect(tree).toMatchSnapshot();
|
|
183
|
-
});
|
|
184
|
-
it('should the status is success', function () {
|
|
185
|
-
var ele = _reactTestRenderer["default"].create( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
186
|
-
text: "secondaryFilled",
|
|
187
|
-
rounded: true,
|
|
188
|
-
status: "success"
|
|
189
|
-
}));
|
|
190
|
-
var tree = ele.toJSON();
|
|
191
|
-
expect(tree).toMatchSnapshot();
|
|
192
|
-
});
|
|
193
|
-
});
|