@zohodesk/components 1.4.17 → 1.4.19
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 +34 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +9 -5
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +4 -1
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +4 -1
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +4 -1
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +4 -1
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +4 -1
- package/assets/Appearance/light/mode/Component_LightMode.module.css +9 -5
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +4 -1
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +4 -1
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +4 -1
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +4 -1
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +4 -1
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +9 -5
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +4 -1
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +4 -1
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +4 -1
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +4 -1
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +4 -1
- package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +2 -2
- package/es/Button/css/Button.module.css +60 -6
- package/es/Button/css/cssJSLogic.js +2 -2
- package/es/Card/__tests__/Card.spec.js +48 -0
- package/es/Card/__tests__/CardContent.spec.js +61 -0
- package/es/Card/__tests__/CardHeader.spec.js +33 -0
- package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
- package/es/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
- package/es/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
- package/es/ListItem/ListItem.js +10 -3
- package/es/ListItem/ListItemWithAvatar.js +15 -6
- package/es/ListItem/ListItemWithCheckBox.js +13 -6
- package/es/ListItem/ListItemWithIcon.js +14 -5
- package/es/ListItem/ListItemWithRadio.js +13 -6
- package/es/ListItem/__tests__/ListItem.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +17 -0
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +19 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
- package/es/ListItem/props/propTypes.js +15 -5
- package/es/MultiSelect/MultiSelect.js +8 -1
- package/es/MultiSelect/Suggestions.js +2 -1
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
- package/es/MultiSelect/props/propTypes.js +2 -3
- package/es/Select/GroupSelect.js +4 -2
- package/es/Select/Select.js +7 -1
- package/es/Select/SelectWithAvatar.js +17 -4
- package/es/Select/SelectWithIcon.js +15 -5
- package/es/Select/props/defaultProps.js +2 -0
- package/es/Select/props/propTypes.js +5 -0
- package/es/Typography/__tests__/Typography.spec.js +225 -0
- package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
- package/es/utils/dropDownUtils.js +13 -4
- package/es/v1/Switch/__tests__/Switch.spec.js +41 -6
- package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
- package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +2 -2
- package/lib/Button/css/Button.module.css +60 -6
- package/lib/Button/css/cssJSLogic.js +1 -1
- package/lib/Card/__tests__/Card.spec.js +54 -6
- package/lib/Card/__tests__/CardContent.spec.js +68 -0
- package/lib/Card/__tests__/CardHeader.spec.js +40 -0
- package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
- package/lib/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
- package/lib/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
- package/lib/ListItem/ListItem.js +10 -3
- package/lib/ListItem/ListItemWithAvatar.js +15 -6
- package/lib/ListItem/ListItemWithCheckBox.js +15 -6
- package/lib/ListItem/ListItemWithIcon.js +13 -5
- package/lib/ListItem/ListItemWithRadio.js +15 -6
- package/lib/ListItem/__tests__/ListItem.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +21 -0
- package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +23 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
- package/lib/ListItem/props/propTypes.js +15 -6
- package/lib/MultiSelect/MultiSelect.js +6 -2
- package/lib/MultiSelect/Suggestions.js +2 -1
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
- package/lib/MultiSelect/props/propTypes.js +3 -4
- package/lib/Select/GroupSelect.js +4 -3
- package/lib/Select/Select.js +7 -1
- package/lib/Select/SelectWithAvatar.js +17 -7
- package/lib/Select/SelectWithIcon.js +15 -5
- package/lib/Select/props/defaultProps.js +2 -1
- package/lib/Select/props/propTypes.js +5 -0
- package/lib/Typography/__tests__/Typography.spec.js +232 -0
- package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
- package/lib/utils/dropDownUtils.js +17 -4
- package/lib/v1/Switch/__tests__/Switch.spec.js +41 -6
- package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
- package/package.json +3 -3
|
@@ -43,6 +43,8 @@ const getDisabledOptions = props => props.disabledOptions || dummyArray;
|
|
|
43
43
|
|
|
44
44
|
const getListItemProps = props => props.listItemProps || '';
|
|
45
45
|
|
|
46
|
+
const getlistItemCustomProps = props => props.listItemCustomProps || dummyObj;
|
|
47
|
+
|
|
46
48
|
const defaultSearchFields = ['value'];
|
|
47
49
|
|
|
48
50
|
const getSearchFields = props => {
|
|
@@ -55,7 +57,7 @@ const getSearchFields = props => {
|
|
|
55
57
|
// }
|
|
56
58
|
|
|
57
59
|
|
|
58
|
-
const isObjectContainsSearchString = function () {
|
|
60
|
+
export const isObjectContainsSearchString = function () {
|
|
59
61
|
let searchFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
60
62
|
let searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
61
63
|
let obj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -133,7 +135,7 @@ export const extractOptionId = id => {
|
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
export const extractOptionIdFromJson = (id, localData) => localData[id] || {};
|
|
136
|
-
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getAllowValueFallback, getSearchFields, getSecondaryField], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, allowValueFallback, searchFields, secondaryField) => {
|
|
138
|
+
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getlistItemCustomProps, getAllowValueFallback, getSearchFields, getSecondaryField], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, listItemCustomProps, allowValueFallback, searchFields, secondaryField) => {
|
|
137
139
|
const revampOptions = [];
|
|
138
140
|
const remvampOptionIds = [];
|
|
139
141
|
const normalizedAllOptions = {};
|
|
@@ -149,7 +151,8 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
149
151
|
optionType: impOptionType,
|
|
150
152
|
iconName: impIconName,
|
|
151
153
|
iconSize: impIconSize,
|
|
152
|
-
listItemProps: listStyle
|
|
154
|
+
listItemProps: listStyle,
|
|
155
|
+
listItemCustomProps: listStyleCustomProps
|
|
153
156
|
} = option;
|
|
154
157
|
let id = typeof option === 'object' ? option[impValueField || valueField] : option;
|
|
155
158
|
const value = typeof option === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
@@ -195,6 +198,10 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
195
198
|
optionDetails.listItemProps = listStyle || listItemProps;
|
|
196
199
|
}
|
|
197
200
|
|
|
201
|
+
if (listStyleCustomProps || listItemCustomProps) {
|
|
202
|
+
optionDetails.listItemCustomProps = listStyleCustomProps || listItemCustomProps;
|
|
203
|
+
}
|
|
204
|
+
|
|
198
205
|
normalizedFormatOptions[id] = optionDetails;
|
|
199
206
|
normalizedAllOptions[id] = { ...option,
|
|
200
207
|
groupId: prefixText
|
|
@@ -321,7 +328,8 @@ export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions
|
|
|
321
328
|
id: groupId,
|
|
322
329
|
name,
|
|
323
330
|
valueField,
|
|
324
|
-
textField
|
|
331
|
+
textField,
|
|
332
|
+
secondaryField
|
|
325
333
|
} = group;
|
|
326
334
|
|
|
327
335
|
if (!getIsEmptyValue(groupId) && groupIds.indexOf(groupId) === -1) {
|
|
@@ -336,6 +344,7 @@ export const makeGetGroupSelectOptions = () => createSelector([getGroupedOptions
|
|
|
336
344
|
options,
|
|
337
345
|
valueField,
|
|
338
346
|
textField,
|
|
347
|
+
secondaryField,
|
|
339
348
|
prefixText: groupId,
|
|
340
349
|
allowValueFallback
|
|
341
350
|
});
|
|
@@ -1,30 +1,65 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import Switch from "../Switch";
|
|
4
|
-
describe('Switch', () => {
|
|
5
|
-
test('
|
|
4
|
+
describe('Switch - Snapshot', () => {
|
|
5
|
+
test('Render with default props', () => {
|
|
6
6
|
const {
|
|
7
7
|
asFragment
|
|
8
8
|
} = render( /*#__PURE__*/React.createElement(Switch, null));
|
|
9
9
|
expect(asFragment()).toMatchSnapshot();
|
|
10
10
|
});
|
|
11
|
-
test('
|
|
11
|
+
test('Render with isChecked=true', () => {
|
|
12
12
|
const {
|
|
13
13
|
asFragment
|
|
14
14
|
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
15
|
-
id: "switch",
|
|
16
15
|
isChecked: true
|
|
17
16
|
}));
|
|
18
17
|
expect(asFragment()).toMatchSnapshot();
|
|
19
18
|
});
|
|
20
|
-
test('
|
|
19
|
+
test('Render with isDisabled=true', () => {
|
|
21
20
|
const {
|
|
22
21
|
asFragment
|
|
23
22
|
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
24
|
-
id: "switch",
|
|
25
23
|
isChecked: true,
|
|
26
24
|
isDisabled: true
|
|
27
25
|
}));
|
|
28
26
|
expect(asFragment()).toMatchSnapshot();
|
|
29
27
|
});
|
|
28
|
+
test('Render with customId and testId', () => {
|
|
29
|
+
const {
|
|
30
|
+
asFragment
|
|
31
|
+
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
32
|
+
customId: "switch-customId",
|
|
33
|
+
testId: "switch-testId"
|
|
34
|
+
}));
|
|
35
|
+
expect(asFragment()).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
test('Render with tag attributes', () => {
|
|
38
|
+
const {
|
|
39
|
+
asFragment
|
|
40
|
+
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
41
|
+
tagAttributes: {
|
|
42
|
+
'data-custom-attr': 'true'
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
expect(asFragment()).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
test('Render with a11y attributes', () => {
|
|
48
|
+
const {
|
|
49
|
+
asFragment
|
|
50
|
+
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
51
|
+
a11yAttributes: {
|
|
52
|
+
role: 'switch'
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
expect(asFragment()).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
test('Render with customClass', () => {
|
|
58
|
+
const {
|
|
59
|
+
asFragment
|
|
60
|
+
} = render( /*#__PURE__*/React.createElement(Switch, {
|
|
61
|
+
customClass: "my-switch"
|
|
62
|
+
}));
|
|
63
|
+
expect(asFragment()).toMatchSnapshot();
|
|
64
|
+
});
|
|
30
65
|
});
|
|
@@ -1,6 +1,179 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Switch
|
|
3
|
+
exports[`Switch - Snapshot Render with a11y attributes 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="inlineFlex row alignItems_center container medium unChecked enabled"
|
|
7
|
+
data-id="flex"
|
|
8
|
+
data-test-id="flex"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="noShrink trackWrapper"
|
|
12
|
+
data-id="flex"
|
|
13
|
+
data-test-id="flex"
|
|
14
|
+
>
|
|
15
|
+
<input
|
|
16
|
+
class="track"
|
|
17
|
+
role="switch"
|
|
18
|
+
type="checkbox"
|
|
19
|
+
value=""
|
|
20
|
+
/>
|
|
21
|
+
<svg
|
|
22
|
+
class="thumb commonSvg"
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
>
|
|
25
|
+
<circle
|
|
26
|
+
cx="50%"
|
|
27
|
+
cy="50%"
|
|
28
|
+
r="42.85%"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
<svg
|
|
32
|
+
class="offLabel commonSvg"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
>
|
|
35
|
+
<circle
|
|
36
|
+
cx="50%"
|
|
37
|
+
cy="50%"
|
|
38
|
+
r="37.5%"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</DocumentFragment>
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
exports[`Switch - Snapshot Render with customClass 1`] = `
|
|
47
|
+
<DocumentFragment>
|
|
48
|
+
<div
|
|
49
|
+
class="inlineFlex row alignItems_center container medium unChecked enabled"
|
|
50
|
+
data-id="flex"
|
|
51
|
+
data-test-id="flex"
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
class="noShrink trackWrapper"
|
|
55
|
+
data-id="flex"
|
|
56
|
+
data-test-id="flex"
|
|
57
|
+
>
|
|
58
|
+
<input
|
|
59
|
+
class="track"
|
|
60
|
+
role="switch"
|
|
61
|
+
type="checkbox"
|
|
62
|
+
value=""
|
|
63
|
+
/>
|
|
64
|
+
<svg
|
|
65
|
+
class="thumb commonSvg"
|
|
66
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
+
>
|
|
68
|
+
<circle
|
|
69
|
+
cx="50%"
|
|
70
|
+
cy="50%"
|
|
71
|
+
r="42.85%"
|
|
72
|
+
/>
|
|
73
|
+
</svg>
|
|
74
|
+
<svg
|
|
75
|
+
class="offLabel commonSvg"
|
|
76
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
77
|
+
>
|
|
78
|
+
<circle
|
|
79
|
+
cx="50%"
|
|
80
|
+
cy="50%"
|
|
81
|
+
r="37.5%"
|
|
82
|
+
/>
|
|
83
|
+
</svg>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</DocumentFragment>
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`Switch - Snapshot Render with customId and testId 1`] = `
|
|
90
|
+
<DocumentFragment>
|
|
91
|
+
<div
|
|
92
|
+
class="inlineFlex row alignItems_center container medium unChecked enabled"
|
|
93
|
+
data-id="switch-customId"
|
|
94
|
+
data-selector-id="switch-customId"
|
|
95
|
+
data-test-id="switch-testId"
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
class="noShrink trackWrapper"
|
|
99
|
+
data-id="flex"
|
|
100
|
+
data-test-id="flex"
|
|
101
|
+
>
|
|
102
|
+
<input
|
|
103
|
+
class="track"
|
|
104
|
+
role="switch"
|
|
105
|
+
type="checkbox"
|
|
106
|
+
value=""
|
|
107
|
+
/>
|
|
108
|
+
<svg
|
|
109
|
+
class="thumb commonSvg"
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
>
|
|
112
|
+
<circle
|
|
113
|
+
cx="50%"
|
|
114
|
+
cy="50%"
|
|
115
|
+
r="42.85%"
|
|
116
|
+
/>
|
|
117
|
+
</svg>
|
|
118
|
+
<svg
|
|
119
|
+
class="offLabel commonSvg"
|
|
120
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
121
|
+
>
|
|
122
|
+
<circle
|
|
123
|
+
cx="50%"
|
|
124
|
+
cy="50%"
|
|
125
|
+
r="37.5%"
|
|
126
|
+
/>
|
|
127
|
+
</svg>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</DocumentFragment>
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
exports[`Switch - Snapshot Render with default props 1`] = `
|
|
134
|
+
<DocumentFragment>
|
|
135
|
+
<div
|
|
136
|
+
class="inlineFlex row alignItems_center container medium unChecked enabled"
|
|
137
|
+
data-id="flex"
|
|
138
|
+
data-test-id="flex"
|
|
139
|
+
>
|
|
140
|
+
<div
|
|
141
|
+
class="noShrink trackWrapper"
|
|
142
|
+
data-id="flex"
|
|
143
|
+
data-test-id="flex"
|
|
144
|
+
>
|
|
145
|
+
<input
|
|
146
|
+
class="track"
|
|
147
|
+
role="switch"
|
|
148
|
+
type="checkbox"
|
|
149
|
+
value=""
|
|
150
|
+
/>
|
|
151
|
+
<svg
|
|
152
|
+
class="thumb commonSvg"
|
|
153
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
154
|
+
>
|
|
155
|
+
<circle
|
|
156
|
+
cx="50%"
|
|
157
|
+
cy="50%"
|
|
158
|
+
r="42.85%"
|
|
159
|
+
/>
|
|
160
|
+
</svg>
|
|
161
|
+
<svg
|
|
162
|
+
class="offLabel commonSvg"
|
|
163
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
164
|
+
>
|
|
165
|
+
<circle
|
|
166
|
+
cx="50%"
|
|
167
|
+
cy="50%"
|
|
168
|
+
r="37.5%"
|
|
169
|
+
/>
|
|
170
|
+
</svg>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</DocumentFragment>
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
exports[`Switch - Snapshot Render with isChecked=true 1`] = `
|
|
4
177
|
<DocumentFragment>
|
|
5
178
|
<div
|
|
6
179
|
class="inlineFlex row alignItems_center container medium checked enabled"
|
|
@@ -15,7 +188,6 @@ exports[`Switch rendering the Switch with Checked 1`] = `
|
|
|
15
188
|
<input
|
|
16
189
|
checked=""
|
|
17
190
|
class="track"
|
|
18
|
-
id="switch"
|
|
19
191
|
role="switch"
|
|
20
192
|
type="checkbox"
|
|
21
193
|
value=""
|
|
@@ -45,7 +217,7 @@ exports[`Switch rendering the Switch with Checked 1`] = `
|
|
|
45
217
|
</DocumentFragment>
|
|
46
218
|
`;
|
|
47
219
|
|
|
48
|
-
exports[`Switch
|
|
220
|
+
exports[`Switch - Snapshot Render with isDisabled=true 1`] = `
|
|
49
221
|
<DocumentFragment>
|
|
50
222
|
<div
|
|
51
223
|
class="inlineFlex row alignItems_center container medium checked disabled"
|
|
@@ -61,7 +233,6 @@ exports[`Switch rendering the Switch with Disabled 1`] = `
|
|
|
61
233
|
aria-disabled="true"
|
|
62
234
|
checked=""
|
|
63
235
|
class="track"
|
|
64
|
-
id="switch"
|
|
65
236
|
role="switch"
|
|
66
237
|
type="checkbox"
|
|
67
238
|
value=""
|
|
@@ -91,7 +262,7 @@ exports[`Switch rendering the Switch with Disabled 1`] = `
|
|
|
91
262
|
</DocumentFragment>
|
|
92
263
|
`;
|
|
93
264
|
|
|
94
|
-
exports[`Switch
|
|
265
|
+
exports[`Switch - Snapshot Render with tag attributes 1`] = `
|
|
95
266
|
<DocumentFragment>
|
|
96
267
|
<div
|
|
97
268
|
class="inlineFlex row alignItems_center container medium unChecked enabled"
|
|
@@ -142,7 +142,7 @@ exports[`Button component Should render CustomStatusclassname of buttons - succe
|
|
|
142
142
|
class="successstate"
|
|
143
143
|
>
|
|
144
144
|
<div
|
|
145
|
-
class="customStautusClassName
|
|
145
|
+
class="customStautusClassName tickElement primaryTick"
|
|
146
146
|
/>
|
|
147
147
|
</div>
|
|
148
148
|
</div>
|
|
@@ -263,7 +263,7 @@ exports[`Button component Should render Status of buttons - success 1`] = `
|
|
|
263
263
|
class="successstate"
|
|
264
264
|
>
|
|
265
265
|
<div
|
|
266
|
-
class="
|
|
266
|
+
class="tickElement primaryTick"
|
|
267
267
|
/>
|
|
268
268
|
</div>
|
|
269
269
|
</div>
|
|
@@ -383,11 +383,36 @@
|
|
|
383
383
|
--button_loading_bg_color: var(--zdt_button_dangerfill_bg);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
.successelement {
|
|
387
|
+
--button_loading_bg_color: var(--zdt_button_loading_default_bg);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.successfilledelement {
|
|
391
|
+
--button_loading_bg_color: var(--zdt_button_successfill_bg);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.secondaryfilledelement {
|
|
395
|
+
--button_loading_bg_color: var(--zdt_button_secondaryfill_bg);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.secondaryelement {
|
|
399
|
+
--button_loading_bg_color: var(--zdt_button_loading_default_bg);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.tertiaryfilledelement {
|
|
403
|
+
--button_loading_bg_color: var(--zdt_button_tertiaryfill_bg);
|
|
404
|
+
}
|
|
405
|
+
|
|
386
406
|
.loadingelement:after,
|
|
387
407
|
.primaryelement:after,
|
|
388
408
|
.primaryfilledelement:after,
|
|
389
409
|
.dangerelement:after,
|
|
390
|
-
.dangerfilledelement:after
|
|
410
|
+
.dangerfilledelement:after,
|
|
411
|
+
.successelement:after,
|
|
412
|
+
.successfilledelement:after,
|
|
413
|
+
.secondaryelement:after,
|
|
414
|
+
.secondaryfilledelement:after,
|
|
415
|
+
.tertiaryfilledelement:after {
|
|
391
416
|
--button_loading_bg_color: inherit;
|
|
392
417
|
}
|
|
393
418
|
|
|
@@ -421,18 +446,47 @@
|
|
|
421
446
|
transform: rotateX(180deg);
|
|
422
447
|
}
|
|
423
448
|
|
|
424
|
-
.
|
|
449
|
+
.primaryTick {
|
|
425
450
|
--button_success_border_color: var(--zdt_button_default_border);
|
|
426
451
|
}
|
|
427
452
|
|
|
428
|
-
.primaryfilled .
|
|
453
|
+
.primaryfilled .tickElement {
|
|
429
454
|
--button_success_border_color: var(--zdt_button_tick_primary_border);
|
|
430
455
|
}
|
|
431
456
|
|
|
432
|
-
.
|
|
457
|
+
.successelement:before {
|
|
458
|
+
--button_loading_bg_color: var(--zdt_button_success_border);
|
|
459
|
+
--zdt_button_loading_linear_gradient: var(--zdt_button_loading_success_linear_gradient);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.secondaryelement:before {
|
|
463
|
+
--button_loading_bg_color: var(--zdt_button_secondaryfill_bg);
|
|
464
|
+
--zdt_button_loading_linear_gradient: var(--zdt_button_loading_secondary_linear_gradient);
|
|
465
|
+
transform: rotateX(180deg);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.dangerTick {
|
|
433
469
|
--button_success_border_color: var(--zdt_button_danger_border);
|
|
434
470
|
}
|
|
435
471
|
|
|
472
|
+
.successTick {
|
|
473
|
+
--button_success_border_color: var(--zdt_button_success_border);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.secondaryTick {
|
|
477
|
+
--button_success_border_color: var(--zdt_button_secondary_border);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.secondaryfilledTick {
|
|
481
|
+
--button_success_border_color: var(--zdt_button_secondary_border);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.secondaryfilledelement:before {
|
|
485
|
+
--button_loading_bg_color: var(--zdt_button_secondaryfill_bg);
|
|
486
|
+
--zdt_button_loading_linear_gradient: var(--zdt_button_loading_secondary_linear_gradient);
|
|
487
|
+
transform: rotateX(180deg);
|
|
488
|
+
}
|
|
489
|
+
|
|
436
490
|
@keyframes crlrotate-ltr {
|
|
437
491
|
0% {
|
|
438
492
|
transform: scaleX(-1) rotate(0deg);
|
|
@@ -502,7 +556,7 @@
|
|
|
502
556
|
z-index: 3;
|
|
503
557
|
}
|
|
504
558
|
|
|
505
|
-
.
|
|
559
|
+
.tickElement {
|
|
506
560
|
height: var(--zd_size15) ;
|
|
507
561
|
position: relative;
|
|
508
562
|
top: calc( var(--zd_size2) * -1 ) ;
|
|
@@ -609,5 +663,5 @@
|
|
|
609
663
|
}
|
|
610
664
|
.successfilledStrike {
|
|
611
665
|
--button_strike_color: var(--zdt_button_successFilled_strike);
|
|
612
|
-
--button_border_color: var(--
|
|
666
|
+
--button_border_color: var(--zdt_button_successfill_border);
|
|
613
667
|
}
|
|
@@ -36,7 +36,7 @@ function cssJSLogic(_ref) {
|
|
|
36
36
|
var canStrikeThrough = !strikeExcludedPalettes.includes(paletteLower);
|
|
37
37
|
var buttonClass = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, customButton, !!customButton), _defineProperty(_compileClassNames, style.bold, isBold), _defineProperty(_compileClassNames, style["default"], !needAppearance), _defineProperty(_compileClassNames, style[paletteLower], needAppearance), _defineProperty(_compileClassNames, style.rounded, needAppearance && rounded), _defineProperty(_compileClassNames, style[size.toLowerCase()], needAppearance && !children), _defineProperty(_compileClassNames, style["".concat(size, "Btn")], needAppearance && children), _defineProperty(_compileClassNames, style["".concat(size, "Btn").concat(paletteLower)], needAppearance && children && rounded), _defineProperty(_compileClassNames, "".concat(style["".concat(paletteLower, "Strike")], " ").concat(style.strike), disabled && canStrikeThrough && shouldStrikeThroughDisabled), _defineProperty(_compileClassNames, style.loader, !!needAppearance && statusLower !== 'none'), _compileClassNames));
|
|
38
38
|
var loaderParentClass = (0, _utils.compileClassNames)((_compileClassNames2 = {}, _defineProperty(_compileClassNames2, customStatusSize, !!customStatusSize), _defineProperty(_compileClassNames2, style.loading, statusLower === 'loading'), _defineProperty(_compileClassNames2, style["".concat(size, "loading")], statusLower === 'loading'), _defineProperty(_compileClassNames2, style.successstate, statusLower != 'loading'), _compileClassNames2));
|
|
39
|
-
var loaderChildClass = (0, _utils.compileClassNames)((_compileClassNames3 = {}, _defineProperty(_compileClassNames3, customStatus, !!customStatus), _defineProperty(_compileClassNames3, style.loadingelement, statusLower === 'loading'), _defineProperty(_compileClassNames3, style["".concat(paletteLower, "element")], statusLower === 'loading'), _defineProperty(_compileClassNames3, style.
|
|
39
|
+
var loaderChildClass = (0, _utils.compileClassNames)((_compileClassNames3 = {}, _defineProperty(_compileClassNames3, customStatus, !!customStatus), _defineProperty(_compileClassNames3, style.loadingelement, statusLower === 'loading'), _defineProperty(_compileClassNames3, style["".concat(paletteLower, "element")], statusLower === 'loading'), _defineProperty(_compileClassNames3, style.tickElement, statusLower != 'loading'), _defineProperty(_compileClassNames3, style["".concat(paletteLower, "Tick")], statusLower != 'loading'), _compileClassNames3));
|
|
40
40
|
return {
|
|
41
41
|
buttonClass: buttonClass,
|
|
42
42
|
loaderParentClass: loaderParentClass,
|
|
@@ -27,8 +27,56 @@ describe('Card', function () {
|
|
|
27
27
|
|
|
28
28
|
expect(asFragment()).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
|
+
test('rendering the children', function () {
|
|
31
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], null, " ", /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
32
|
+
asFragment = _render2.asFragment;
|
|
33
|
+
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
test('rendering the isScrollAttribute is true', function () {
|
|
37
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
38
|
+
isScrollAttribute: true
|
|
39
|
+
}, " ", /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
40
|
+
asFragment = _render3.asFragment;
|
|
41
|
+
|
|
42
|
+
expect(asFragment()).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
test('rendering the dataId value', function () {
|
|
45
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
46
|
+
dataId: "customdataId"
|
|
47
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
48
|
+
asFragment = _render4.asFragment;
|
|
49
|
+
|
|
50
|
+
expect(asFragment()).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
test('rendering the customClass', function () {
|
|
53
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
54
|
+
customClass: "customClass"
|
|
55
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
56
|
+
asFragment = _render5.asFragment;
|
|
57
|
+
|
|
58
|
+
expect(asFragment()).toMatchSnapshot();
|
|
59
|
+
});
|
|
60
|
+
test('rendering the htmlId', function () {
|
|
61
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
62
|
+
htmlId: "customHtmlId"
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
64
|
+
asFragment = _render6.asFragment;
|
|
65
|
+
|
|
66
|
+
expect(asFragment()).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
test('rendering the a11y', function () {
|
|
69
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
70
|
+
a11y: {
|
|
71
|
+
role: 'button'
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test"))),
|
|
74
|
+
asFragment = _render7.asFragment;
|
|
75
|
+
|
|
76
|
+
expect(asFragment()).toMatchSnapshot();
|
|
77
|
+
});
|
|
30
78
|
test('should trigger fetch, when scroll to the bottom of the card while isRecentOnBottom = false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
31
|
-
var mockGetNextOptions,
|
|
79
|
+
var mockGetNextOptions, _render8, getByTestId, asFragment, cardContent;
|
|
32
80
|
|
|
33
81
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
82
|
while (1) {
|
|
@@ -39,13 +87,13 @@ describe('Card', function () {
|
|
|
39
87
|
resolve();
|
|
40
88
|
});
|
|
41
89
|
});
|
|
42
|
-
|
|
90
|
+
_render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
43
91
|
from: 0,
|
|
44
92
|
limit: 10,
|
|
45
93
|
fetchData: mockGetNextOptions
|
|
46
94
|
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
47
95
|
dataId: "scrollToBottomCardContent"
|
|
48
|
-
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId =
|
|
96
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render8.getByTestId, asFragment = _render8.asFragment;
|
|
49
97
|
cardContent = getByTestId('scrollToBottomCardContent');
|
|
50
98
|
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
51
99
|
value: 1000,
|
|
@@ -80,7 +128,7 @@ describe('Card', function () {
|
|
|
80
128
|
}, _callee);
|
|
81
129
|
})));
|
|
82
130
|
test('should trigger fetch, when scroll to the top of the card while scrollDirection = bottomToTop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
83
|
-
var mockGetNextOptions,
|
|
131
|
+
var mockGetNextOptions, _render9, getByTestId, asFragment, cardContent;
|
|
84
132
|
|
|
85
133
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
86
134
|
while (1) {
|
|
@@ -91,14 +139,14 @@ describe('Card', function () {
|
|
|
91
139
|
resolve();
|
|
92
140
|
});
|
|
93
141
|
});
|
|
94
|
-
|
|
142
|
+
_render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
95
143
|
from: 0,
|
|
96
144
|
limit: 10,
|
|
97
145
|
scrollDirection: "bottomToTop",
|
|
98
146
|
fetchData: mockGetNextOptions
|
|
99
147
|
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
100
148
|
dataId: "scrollToTopCardContent"
|
|
101
|
-
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId =
|
|
149
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render9.getByTestId, asFragment = _render9.asFragment;
|
|
102
150
|
cardContent = getByTestId('scrollToTopCardContent');
|
|
103
151
|
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
104
152
|
value: 1000,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
|
|
7
|
+
var _Card = require("../Card");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
describe('CardContent', function () {
|
|
12
|
+
test('rendering the defult props', function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null)),
|
|
14
|
+
asFragment = _render.asFragment;
|
|
15
|
+
|
|
16
|
+
expect(asFragment()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
test('rendering children', function () {
|
|
19
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, null, "Test")),
|
|
20
|
+
asFragment = _render2.asFragment;
|
|
21
|
+
|
|
22
|
+
expect(asFragment()).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
test('rendering isScrollAttribute is true', function () {
|
|
25
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
26
|
+
isScrollAttribute: true
|
|
27
|
+
}, "Test")),
|
|
28
|
+
asFragment = _render3.asFragment;
|
|
29
|
+
|
|
30
|
+
expect(asFragment()).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
var scroll = ['vertical', 'horizontal', 'both', 'none'];
|
|
33
|
+
test.each(scroll)('Should render with name - %s', function (scroll) {
|
|
34
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
35
|
+
isScrollAttribute: true,
|
|
36
|
+
scroll: scroll
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Test Animation"))),
|
|
38
|
+
asFragment = _render4.asFragment;
|
|
39
|
+
|
|
40
|
+
expect(asFragment()).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
test('rendering shrink is true', function () {
|
|
43
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
44
|
+
shrink: true
|
|
45
|
+
}, "Test")),
|
|
46
|
+
asFragment = _render5.asFragment;
|
|
47
|
+
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
test('rendering customClass is true', function () {
|
|
51
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
52
|
+
customClass: "cardCustomClass"
|
|
53
|
+
}, "Test")),
|
|
54
|
+
asFragment = _render6.asFragment;
|
|
55
|
+
|
|
56
|
+
expect(asFragment()).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
var preventParentScroll = ['vertical', 'horizontal', 'both'];
|
|
59
|
+
test.each(preventParentScroll)('Should render with name - %s', function (preventParentScroll) {
|
|
60
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
61
|
+
isScrollAttribute: true,
|
|
62
|
+
preventParentScroll: preventParentScroll
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Test"))),
|
|
64
|
+
asFragment = _render7.asFragment;
|
|
65
|
+
|
|
66
|
+
expect(asFragment()).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
});
|