@zohodesk/components 1.2.33 → 1.2.34
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 +4 -0
- package/es/AppContainer/__tests__/AppContainer.spec.js +82 -0
- package/es/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +201 -0
- package/es/Button/__tests__/Button.spec.js +8 -21
- package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -28
- package/es/CheckBox/__tests__/CheckBox.spec.js +240 -0
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1878 -0
- package/es/Radio/__tests__/Radio.spec.js +6 -9
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +128 -49
- package/es/RippleEffect/__tests__/RippleEffect.spec.js +1 -1
- package/es/RippleEffect/__tests__/__snapshots__/RippleEffect.spec.js.snap +0 -10
- package/es/Select/GroupSelect.js +2 -2
- package/es/Tag/__tests__/Tag.spec.js +235 -0
- package/es/Tag/__tests__/__snapshots__/Tag.spec.js.snap +3054 -0
- package/es/TextBox/__tests__/TextBox.spec.js +327 -0
- package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +615 -0
- package/es/TextBox/props/propTypes.js +0 -3
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +268 -0
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +1784 -0
- package/es/TextBoxIcon/props/propTypes.js +1 -1
- package/es/Textarea/__tests__/Textarea.spec.js +228 -0
- package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +476 -0
- package/es/utils/dropDownUtils.js +4 -1
- package/es/v1/Select/GroupSelect.js +2 -2
- package/lib/AppContainer/__tests__/AppContainer.spec.js +90 -0
- package/lib/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +201 -0
- package/lib/Button/__tests__/Button.spec.js +8 -21
- package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -28
- package/lib/CheckBox/__tests__/CheckBox.spec.js +248 -0
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +1878 -0
- package/lib/Radio/__tests__/Radio.spec.js +9 -13
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +128 -49
- package/lib/RippleEffect/__tests__/RippleEffect.spec.js +1 -1
- package/lib/RippleEffect/__tests__/__snapshots__/RippleEffect.spec.js.snap +0 -10
- package/lib/Select/GroupSelect.js +12 -12
- package/lib/Tag/__tests__/Tag.spec.js +252 -0
- package/lib/Tag/__tests__/__snapshots__/Tag.spec.js.snap +3054 -0
- package/lib/TextBox/__tests__/TextBox.spec.js +334 -0
- package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +615 -0
- package/lib/TextBox/props/propTypes.js +53 -51
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +279 -0
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +1784 -0
- package/lib/TextBoxIcon/props/propTypes.js +1 -1
- package/lib/Textarea/__tests__/Textarea.spec.js +235 -0
- package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +476 -0
- package/lib/utils/dropDownUtils.js +14 -2
- package/lib/v1/Select/GroupSelect.js +12 -12
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -104,6 +104,7 @@ export const extractOptionId = id => {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
+
export const extractOptionIdFromJson = (id, localData) => localData[id] || {};
|
|
107
108
|
export const makeFormatOptions = () => createSelector([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps], (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps) => {
|
|
108
109
|
const revampOptions = [];
|
|
109
110
|
const remvampOptionIds = [];
|
|
@@ -156,7 +157,9 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
normalizedFormatOptions[id] = optionDetails;
|
|
159
|
-
normalizedAllOptions[id] = option
|
|
160
|
+
normalizedAllOptions[id] = { ...option,
|
|
161
|
+
groupId: prefixText
|
|
162
|
+
};
|
|
160
163
|
revampOptions.push(optionDetails);
|
|
161
164
|
}
|
|
162
165
|
}
|
|
@@ -20,7 +20,7 @@ import { ResponsiveReceiver } from '../../Responsive/CustomResponsive';
|
|
|
20
20
|
import style from '../../Select/Select.module.css';
|
|
21
21
|
/**** Methods ****/
|
|
22
22
|
|
|
23
|
-
import { makeGetGroupSelectOptions, optionIdGrouping, makeGetGroupSelectFilterSuggestions, extractOptionId } from '../../utils/dropDownUtils';
|
|
23
|
+
import { makeGetGroupSelectOptions, optionIdGrouping, makeGetGroupSelectFilterSuggestions, extractOptionId, extractOptionIdFromJson } from '../../utils/dropDownUtils';
|
|
24
24
|
import { getIsEmptyValue, scrollTo, debounce, getSearchString, findScrollEnd, getKeyValue } from '../../utils/Common';
|
|
25
25
|
/* eslint-disable react/no-unused-prop-types */
|
|
26
26
|
|
|
@@ -359,7 +359,7 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
359
359
|
let {
|
|
360
360
|
id: selected,
|
|
361
361
|
groupId
|
|
362
|
-
} = extractOptionId(id);
|
|
362
|
+
} = extractOptionId(id) || extractOptionIdFromJson(id, normalizedAllOptions);
|
|
363
363
|
|
|
364
364
|
if (!getIsEmptyValue(id) && !isReadOnly) {
|
|
365
365
|
onChange && onChange({
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
|
|
7
|
+
var _AppContainer = _interopRequireDefault(require("../AppContainer.js"));
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
describe('AppContainer', function () {
|
|
12
|
+
test('rendering the defult props', function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], null)),
|
|
14
|
+
asFragment = _render.asFragment;
|
|
15
|
+
|
|
16
|
+
expect(asFragment()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
test('rendering the customClass', function () {
|
|
19
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
20
|
+
className: "AppcontainerClass"
|
|
21
|
+
})),
|
|
22
|
+
asFragment = _render2.asFragment;
|
|
23
|
+
|
|
24
|
+
expect(asFragment()).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
test('rendering the needTooltip is false', function () {
|
|
27
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
28
|
+
needTooltip: false
|
|
29
|
+
})),
|
|
30
|
+
asFragment = _render3.asFragment;
|
|
31
|
+
|
|
32
|
+
expect(asFragment()).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('rendering the tooltipClass', function () {
|
|
35
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
36
|
+
tooltipClass: "customTooltipClass"
|
|
37
|
+
})),
|
|
38
|
+
asFragment = _render4.asFragment;
|
|
39
|
+
|
|
40
|
+
expect(asFragment()).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
test('rendering the tooltipParentClass', function () {
|
|
43
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
44
|
+
tooltipParentClass: "tooltipParentClass"
|
|
45
|
+
})),
|
|
46
|
+
asFragment = _render5.asFragment;
|
|
47
|
+
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
test('rendering the Custom props', function () {
|
|
51
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
52
|
+
customProps: {
|
|
53
|
+
ExtraProps: {
|
|
54
|
+
'data-props': true
|
|
55
|
+
},
|
|
56
|
+
ContainerProps: {
|
|
57
|
+
'data-container': true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})),
|
|
61
|
+
asFragment = _render6.asFragment;
|
|
62
|
+
|
|
63
|
+
expect(asFragment()).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
test('eleRef prop is a function', function () {
|
|
66
|
+
var mockEleRef = jest.fn();
|
|
67
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], {
|
|
68
|
+
eleRef: mockEleRef
|
|
69
|
+
}));
|
|
70
|
+
expect(mockEleRef).toHaveBeenCalled();
|
|
71
|
+
});
|
|
72
|
+
test('rendering the childern as element', function () {
|
|
73
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], null, /*#__PURE__*/_react["default"].createElement("div", null, "Children"))),
|
|
74
|
+
asFragment = _render7.asFragment;
|
|
75
|
+
|
|
76
|
+
expect(asFragment()).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
test('rendering the childern as element in array', function () {
|
|
79
|
+
var children = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
80
|
+
key: "child1"
|
|
81
|
+
}, "Child 1"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
82
|
+
key: "child2"
|
|
83
|
+
}, "Child 2")];
|
|
84
|
+
|
|
85
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AppContainer["default"], null, children)),
|
|
86
|
+
asFragment = _render8.asFragment;
|
|
87
|
+
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`AppContainer rendering the Custom props 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="container flex cover coldir"
|
|
7
|
+
data-container="true"
|
|
8
|
+
data-id="AppContainer"
|
|
9
|
+
data-props="true"
|
|
10
|
+
data-selector-id="appContainer"
|
|
11
|
+
data-test-id="AppContainer"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
class="grow basis shrinkOff"
|
|
15
|
+
data-id="boxComponent"
|
|
16
|
+
data-selector-id="box"
|
|
17
|
+
data-test-id="boxComponent"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div
|
|
21
|
+
class="container tooltip "
|
|
22
|
+
data-id="AppContainer_tooltip"
|
|
23
|
+
data-props="true"
|
|
24
|
+
data-selector-id="appContainer_tooltip"
|
|
25
|
+
data-test-id="AppContainer_tooltip"
|
|
26
|
+
/>
|
|
27
|
+
</DocumentFragment>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`AppContainer rendering the childern as element 1`] = `
|
|
31
|
+
<DocumentFragment>
|
|
32
|
+
<div
|
|
33
|
+
class="container flex cover coldir"
|
|
34
|
+
data-id="AppContainer"
|
|
35
|
+
data-selector-id="appContainer"
|
|
36
|
+
data-test-id="AppContainer"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
class="grow basis shrinkOff"
|
|
40
|
+
data-id="boxComponent"
|
|
41
|
+
data-selector-id="box"
|
|
42
|
+
data-test-id="boxComponent"
|
|
43
|
+
>
|
|
44
|
+
<div>
|
|
45
|
+
Children
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
class="container tooltip "
|
|
51
|
+
data-id="AppContainer_tooltip"
|
|
52
|
+
data-selector-id="appContainer_tooltip"
|
|
53
|
+
data-test-id="AppContainer_tooltip"
|
|
54
|
+
/>
|
|
55
|
+
</DocumentFragment>
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
exports[`AppContainer rendering the childern as element in array 1`] = `
|
|
59
|
+
<DocumentFragment>
|
|
60
|
+
<div
|
|
61
|
+
class="container flex cover coldir"
|
|
62
|
+
data-id="AppContainer"
|
|
63
|
+
data-selector-id="appContainer"
|
|
64
|
+
data-test-id="AppContainer"
|
|
65
|
+
>
|
|
66
|
+
<div
|
|
67
|
+
class="grow basis shrinkOff"
|
|
68
|
+
data-id="boxComponent"
|
|
69
|
+
data-selector-id="box"
|
|
70
|
+
data-test-id="boxComponent"
|
|
71
|
+
>
|
|
72
|
+
<div>
|
|
73
|
+
Child 1
|
|
74
|
+
</div>
|
|
75
|
+
<span>
|
|
76
|
+
Child 2
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
class="container tooltip "
|
|
82
|
+
data-id="AppContainer_tooltip"
|
|
83
|
+
data-selector-id="appContainer_tooltip"
|
|
84
|
+
data-test-id="AppContainer_tooltip"
|
|
85
|
+
/>
|
|
86
|
+
</DocumentFragment>
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`AppContainer rendering the customClass 1`] = `
|
|
90
|
+
<DocumentFragment>
|
|
91
|
+
<div
|
|
92
|
+
class="container AppcontainerClass flex cover coldir"
|
|
93
|
+
data-id="AppContainer"
|
|
94
|
+
data-selector-id="appContainer"
|
|
95
|
+
data-test-id="AppContainer"
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
class="grow basis shrinkOff"
|
|
99
|
+
data-id="boxComponent"
|
|
100
|
+
data-selector-id="box"
|
|
101
|
+
data-test-id="boxComponent"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
<div
|
|
105
|
+
class="container tooltip "
|
|
106
|
+
data-id="AppContainer_tooltip"
|
|
107
|
+
data-selector-id="appContainer_tooltip"
|
|
108
|
+
data-test-id="AppContainer_tooltip"
|
|
109
|
+
/>
|
|
110
|
+
</DocumentFragment>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
exports[`AppContainer rendering the defult props 1`] = `
|
|
114
|
+
<DocumentFragment>
|
|
115
|
+
<div
|
|
116
|
+
class="container flex cover coldir"
|
|
117
|
+
data-id="AppContainer"
|
|
118
|
+
data-selector-id="appContainer"
|
|
119
|
+
data-test-id="AppContainer"
|
|
120
|
+
>
|
|
121
|
+
<div
|
|
122
|
+
class="grow basis shrinkOff"
|
|
123
|
+
data-id="boxComponent"
|
|
124
|
+
data-selector-id="box"
|
|
125
|
+
data-test-id="boxComponent"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<div
|
|
129
|
+
class="container tooltip "
|
|
130
|
+
data-id="AppContainer_tooltip"
|
|
131
|
+
data-selector-id="appContainer_tooltip"
|
|
132
|
+
data-test-id="AppContainer_tooltip"
|
|
133
|
+
/>
|
|
134
|
+
</DocumentFragment>
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`AppContainer rendering the needTooltip is false 1`] = `
|
|
138
|
+
<DocumentFragment>
|
|
139
|
+
<div
|
|
140
|
+
class="container flex cover coldir"
|
|
141
|
+
data-id="AppContainer"
|
|
142
|
+
data-selector-id="appContainer"
|
|
143
|
+
data-test-id="AppContainer"
|
|
144
|
+
>
|
|
145
|
+
<div
|
|
146
|
+
class="grow basis shrinkOff"
|
|
147
|
+
data-id="boxComponent"
|
|
148
|
+
data-selector-id="box"
|
|
149
|
+
data-test-id="boxComponent"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</DocumentFragment>
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
exports[`AppContainer rendering the tooltipClass 1`] = `
|
|
156
|
+
<DocumentFragment>
|
|
157
|
+
<div
|
|
158
|
+
class="container flex cover coldir"
|
|
159
|
+
data-id="AppContainer"
|
|
160
|
+
data-selector-id="appContainer"
|
|
161
|
+
data-test-id="AppContainer"
|
|
162
|
+
>
|
|
163
|
+
<div
|
|
164
|
+
class="grow basis shrinkOff"
|
|
165
|
+
data-id="boxComponent"
|
|
166
|
+
data-selector-id="box"
|
|
167
|
+
data-test-id="boxComponent"
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
<div
|
|
171
|
+
class="container tooltip "
|
|
172
|
+
data-id="AppContainer_tooltip"
|
|
173
|
+
data-selector-id="appContainer_tooltip"
|
|
174
|
+
data-test-id="AppContainer_tooltip"
|
|
175
|
+
/>
|
|
176
|
+
</DocumentFragment>
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
exports[`AppContainer rendering the tooltipParentClass 1`] = `
|
|
180
|
+
<DocumentFragment>
|
|
181
|
+
<div
|
|
182
|
+
class="container flex cover coldir"
|
|
183
|
+
data-id="AppContainer"
|
|
184
|
+
data-selector-id="appContainer"
|
|
185
|
+
data-test-id="AppContainer"
|
|
186
|
+
>
|
|
187
|
+
<div
|
|
188
|
+
class="grow basis shrinkOff"
|
|
189
|
+
data-id="boxComponent"
|
|
190
|
+
data-selector-id="box"
|
|
191
|
+
data-test-id="boxComponent"
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
<div
|
|
195
|
+
class="container tooltip tooltipParentClass"
|
|
196
|
+
data-id="AppContainer_tooltip"
|
|
197
|
+
data-selector-id="appContainer_tooltip"
|
|
198
|
+
data-test-id="AppContainer_tooltip"
|
|
199
|
+
/>
|
|
200
|
+
</DocumentFragment>
|
|
201
|
+
`;
|
|
@@ -105,25 +105,12 @@ describe('Button component', function () {
|
|
|
105
105
|
asFragment = _render11.asFragment;
|
|
106
106
|
|
|
107
107
|
expect(asFragment()).toMatchSnapshot();
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
expect(asFragment()).toMatchSnapshot();
|
|
118
|
-
});
|
|
119
|
-
test('Should be render with the customstyle with medium ', function () {
|
|
120
|
-
var _render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
121
|
-
customStyle: {
|
|
122
|
-
$medium: "buttonMedium"
|
|
123
|
-
}
|
|
124
|
-
})),
|
|
125
|
-
asFragment = _render13.asFragment;
|
|
126
|
-
|
|
127
|
-
expect(asFragment()).toMatchSnapshot();
|
|
128
|
-
});
|
|
108
|
+
}); // test('Should be render with the basic set customstyle ', () => {
|
|
109
|
+
// const { asFragment } = render(<Button customStyle={{bold: "buttonBold"}} />);
|
|
110
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
111
|
+
// });
|
|
112
|
+
// test('Should be render with the customstyle with medium ', () => {
|
|
113
|
+
// const { asFragment } = render(<Button customStyle={{$medium: "buttonMedium"}} />);
|
|
114
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
115
|
+
// });
|
|
129
116
|
});
|
|
@@ -28,20 +28,6 @@ exports[`Button component Should be render with the basic set customstatusSize p
|
|
|
28
28
|
</DocumentFragment>
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
|
-
exports[`Button component Should be render with the basic set customstyle 1`] = `
|
|
32
|
-
<DocumentFragment>
|
|
33
|
-
<button
|
|
34
|
-
class="bold buttonBold primary medium"
|
|
35
|
-
data-id="buttonComp"
|
|
36
|
-
data-selector-id="button"
|
|
37
|
-
data-test-id="buttonComp"
|
|
38
|
-
type="button"
|
|
39
|
-
>
|
|
40
|
-
Button
|
|
41
|
-
</button>
|
|
42
|
-
</DocumentFragment>
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
31
|
exports[`Button component Should be render with the basic set of default props 1`] = `
|
|
46
32
|
<DocumentFragment>
|
|
47
33
|
<button
|
|
@@ -113,20 +99,6 @@ exports[`Button component Should be render with the basic set of default props w
|
|
|
113
99
|
</DocumentFragment>
|
|
114
100
|
`;
|
|
115
101
|
|
|
116
|
-
exports[`Button component Should be render with the customstyle with medium 1`] = `
|
|
117
|
-
<DocumentFragment>
|
|
118
|
-
<button
|
|
119
|
-
class="bold primary buttonMedium"
|
|
120
|
-
data-id="buttonComp"
|
|
121
|
-
data-selector-id="button"
|
|
122
|
-
data-test-id="buttonComp"
|
|
123
|
-
type="button"
|
|
124
|
-
>
|
|
125
|
-
Button
|
|
126
|
-
</button>
|
|
127
|
-
</DocumentFragment>
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
102
|
exports[`Button component Should render CustomStatusclassname of buttons - loading 1`] = `
|
|
131
103
|
<DocumentFragment>
|
|
132
104
|
<button
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _CheckBox = _interopRequireDefault(require("../CheckBox"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
describe('CheckBox component', function () {
|
|
12
|
+
test('Should be render with the basic set of default props', function () {
|
|
13
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], null)),
|
|
14
|
+
asFragment = _render.asFragment;
|
|
15
|
+
|
|
16
|
+
expect(asFragment()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
test('Should be render ID', function () {
|
|
19
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
20
|
+
id: "checkBoxId",
|
|
21
|
+
text: "checkBoxText"
|
|
22
|
+
})),
|
|
23
|
+
asFragment = _render2.asFragment;
|
|
24
|
+
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
var palette = ['primary', 'danger'];
|
|
28
|
+
test.each(palette)('Should render palette and checkbox with checked - %s', function (palette) {
|
|
29
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
30
|
+
checked: true,
|
|
31
|
+
palette: palette,
|
|
32
|
+
text: "checkBoxTest",
|
|
33
|
+
active: true
|
|
34
|
+
})),
|
|
35
|
+
asFragment = _render3.asFragment;
|
|
36
|
+
|
|
37
|
+
expect(asFragment()).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
test('Should be disable', function () {
|
|
40
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
41
|
+
disabled: true,
|
|
42
|
+
checked: true,
|
|
43
|
+
text: "checkboxDisable"
|
|
44
|
+
})),
|
|
45
|
+
asFragment = _render4.asFragment;
|
|
46
|
+
|
|
47
|
+
expect(asFragment()).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
test('Should be isReadOnly', function () {
|
|
50
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
51
|
+
isReadOnly: true
|
|
52
|
+
})),
|
|
53
|
+
asFragment = _render5.asFragment;
|
|
54
|
+
|
|
55
|
+
expect(asFragment()).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
test('Should be render disabledTitle and title', function () {
|
|
58
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
59
|
+
disabled: true,
|
|
60
|
+
disabledTitle: "checkBoxdisableTitle",
|
|
61
|
+
text: "CheckBoxdisabledTitle",
|
|
62
|
+
title: "checkBoxTitle"
|
|
63
|
+
})),
|
|
64
|
+
asFragment = _render6.asFragment;
|
|
65
|
+
|
|
66
|
+
expect(asFragment()).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
test('Should be render title', function () {
|
|
69
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
70
|
+
text: "CheckBoxdisabledTitle",
|
|
71
|
+
title: "checkBoxTitle"
|
|
72
|
+
})),
|
|
73
|
+
asFragment = _render7.asFragment;
|
|
74
|
+
|
|
75
|
+
expect(asFragment()).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
test('Should be render text', function () {
|
|
78
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
79
|
+
text: "CheckBoxdisabledTitle"
|
|
80
|
+
})),
|
|
81
|
+
asFragment = _render8.asFragment;
|
|
82
|
+
|
|
83
|
+
expect(asFragment()).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
var size = ['small', 'medium'];
|
|
86
|
+
test.each(size)('Should render size - %s', function (size) {
|
|
87
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
88
|
+
checked: true,
|
|
89
|
+
size: size
|
|
90
|
+
})),
|
|
91
|
+
asFragment = _render9.asFragment;
|
|
92
|
+
|
|
93
|
+
expect(asFragment()).toMatchSnapshot();
|
|
94
|
+
});
|
|
95
|
+
var labelPalette = ['default', 'primary', 'secondary', 'danger', 'mandatory'];
|
|
96
|
+
test.each(labelPalette)('Should render size - %s', function (labelPalette) {
|
|
97
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
98
|
+
text: "checkboxText",
|
|
99
|
+
labelPalette: labelPalette
|
|
100
|
+
})),
|
|
101
|
+
asFragment = _render10.asFragment;
|
|
102
|
+
|
|
103
|
+
expect(asFragment()).toMatchSnapshot();
|
|
104
|
+
});
|
|
105
|
+
var labelSize = ['small', 'medium', 'large'];
|
|
106
|
+
test.each(labelSize)('Should render labelSize - %s', function (labelSize) {
|
|
107
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
108
|
+
text: "checkboxText",
|
|
109
|
+
labelSize: labelSize
|
|
110
|
+
})),
|
|
111
|
+
asFragment = _render11.asFragment;
|
|
112
|
+
|
|
113
|
+
expect(asFragment()).toMatchSnapshot();
|
|
114
|
+
});
|
|
115
|
+
test('Should be render isFilled', function () {
|
|
116
|
+
var _render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
117
|
+
isFilled: true
|
|
118
|
+
})),
|
|
119
|
+
asFragment = _render12.asFragment;
|
|
120
|
+
|
|
121
|
+
expect(asFragment()).toMatchSnapshot();
|
|
122
|
+
});
|
|
123
|
+
test('Should be render isClipped is false', function () {
|
|
124
|
+
var _render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
125
|
+
isClipped: false
|
|
126
|
+
})),
|
|
127
|
+
asFragment = _render13.asFragment;
|
|
128
|
+
|
|
129
|
+
expect(asFragment()).toMatchSnapshot();
|
|
130
|
+
});
|
|
131
|
+
test('eleRef prop is a function', function () {
|
|
132
|
+
// Create a mock function
|
|
133
|
+
var mockEleRef = jest.fn();
|
|
134
|
+
|
|
135
|
+
var _render14 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
136
|
+
getRef: mockEleRef
|
|
137
|
+
})),
|
|
138
|
+
asFragment = _render14.asFragment;
|
|
139
|
+
|
|
140
|
+
expect(mockEleRef).toHaveBeenCalled();
|
|
141
|
+
});
|
|
142
|
+
var variant = ['default', 'primary'];
|
|
143
|
+
test.each(variant)('Should render labelSize - %s', function (variant) {
|
|
144
|
+
var _render15 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
145
|
+
text: "checkboxText",
|
|
146
|
+
variant: variant
|
|
147
|
+
})),
|
|
148
|
+
asFragment = _render15.asFragment;
|
|
149
|
+
|
|
150
|
+
expect(asFragment()).toMatchSnapshot();
|
|
151
|
+
});
|
|
152
|
+
test.each(palette)('Should render active - %s', function (palette) {
|
|
153
|
+
var _render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
154
|
+
text: "checkboxText",
|
|
155
|
+
checked: true,
|
|
156
|
+
active: true,
|
|
157
|
+
palette: palette
|
|
158
|
+
})),
|
|
159
|
+
asFragment = _render16.asFragment;
|
|
160
|
+
|
|
161
|
+
expect(asFragment()).toMatchSnapshot();
|
|
162
|
+
});
|
|
163
|
+
test('Should be render name', function () {
|
|
164
|
+
var _render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
165
|
+
name: "checkBoxName"
|
|
166
|
+
})),
|
|
167
|
+
asFragment = _render17.asFragment;
|
|
168
|
+
|
|
169
|
+
expect(asFragment()).toMatchSnapshot();
|
|
170
|
+
});
|
|
171
|
+
test('Should be render activeStyle is minus', function () {
|
|
172
|
+
var _render18 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
173
|
+
activeStyle: "minus"
|
|
174
|
+
})),
|
|
175
|
+
asFragment = _render18.asFragment;
|
|
176
|
+
|
|
177
|
+
expect(asFragment()).toMatchSnapshot();
|
|
178
|
+
});
|
|
179
|
+
test('Should be render dataSelectorId', function () {
|
|
180
|
+
var _render19 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
181
|
+
dataSelectorId: "dataSelectorIdCheck"
|
|
182
|
+
})),
|
|
183
|
+
asFragment = _render19.asFragment;
|
|
184
|
+
|
|
185
|
+
expect(asFragment()).toMatchSnapshot();
|
|
186
|
+
});
|
|
187
|
+
test('rendering the Custom Props', function () {
|
|
188
|
+
var _render20 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
189
|
+
text: "checkboxText",
|
|
190
|
+
customProps: {
|
|
191
|
+
CheckBoxProps: {
|
|
192
|
+
'data-props': true
|
|
193
|
+
},
|
|
194
|
+
LabelProps: {
|
|
195
|
+
'customClass': 'checkBoxCustomClass'
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})),
|
|
199
|
+
asFragment = _render20.asFragment;
|
|
200
|
+
|
|
201
|
+
expect(asFragment()).toMatchSnapshot();
|
|
202
|
+
});
|
|
203
|
+
test('rendering the Custom class', function () {
|
|
204
|
+
var _render21 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
205
|
+
text: "checkboxText",
|
|
206
|
+
checked: true,
|
|
207
|
+
customClass: {
|
|
208
|
+
customCheckBox: 'customCheckBoxClass',
|
|
209
|
+
customLabel: 'customLabelClass',
|
|
210
|
+
customCBoxSize: 'customCBoxSizeClass',
|
|
211
|
+
customTickSize: 'customTickSizeClass'
|
|
212
|
+
}
|
|
213
|
+
})),
|
|
214
|
+
asFragment = _render21.asFragment;
|
|
215
|
+
|
|
216
|
+
expect(asFragment()).toMatchSnapshot();
|
|
217
|
+
});
|
|
218
|
+
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role true and entering their values', function () {
|
|
219
|
+
var _render22 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
220
|
+
checked: true,
|
|
221
|
+
a11y: {
|
|
222
|
+
ariaLabel: 'ariaLabelCheckBox',
|
|
223
|
+
ariaLabelledby: 'ariaLabelledbyCheckBox',
|
|
224
|
+
ariaChecked: true,
|
|
225
|
+
ariaHidden: true,
|
|
226
|
+
role: 'checkBox2'
|
|
227
|
+
}
|
|
228
|
+
})),
|
|
229
|
+
asFragment = _render22.asFragment;
|
|
230
|
+
|
|
231
|
+
expect(asFragment()).toMatchSnapshot();
|
|
232
|
+
});
|
|
233
|
+
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role false and entering their values', function () {
|
|
234
|
+
var _render23 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_CheckBox["default"], {
|
|
235
|
+
checked: true,
|
|
236
|
+
a11y: {
|
|
237
|
+
ariaLabel: 'ariaLabelCheckBox',
|
|
238
|
+
ariaLabelledby: 'ariaLabelledbyCheckBox',
|
|
239
|
+
ariaChecked: false,
|
|
240
|
+
ariaHidden: false,
|
|
241
|
+
role: 'checkBox3'
|
|
242
|
+
}
|
|
243
|
+
})),
|
|
244
|
+
asFragment = _render23.asFragment;
|
|
245
|
+
|
|
246
|
+
expect(asFragment()).toMatchSnapshot();
|
|
247
|
+
});
|
|
248
|
+
});
|