@zohodesk/components 1.2.32 → 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/.cli/propValidation_report.html +1 -1
- package/README.md +8 -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/MultiSelect/AdvancedMultiSelect.js +6 -2
- package/es/MultiSelect/props/defaultProps.js +2 -1
- package/es/MultiSelect/props/propTypes.js +2 -1
- 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/MultiSelect/AdvancedMultiSelect.js +6 -2
- package/es/v1/MultiSelect/props/defaultProps.js +2 -1
- package/es/v1/MultiSelect/props/propTypes.js +2 -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/MultiSelect/AdvancedMultiSelect.js +5 -2
- package/lib/MultiSelect/props/defaultProps.js +2 -1
- package/lib/MultiSelect/props/propTypes.js +2 -1
- 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/MultiSelect/AdvancedMultiSelect.js +5 -2
- package/lib/v1/MultiSelect/props/defaultProps.js +2 -1
- package/lib/v1/MultiSelect/props/propTypes.js +2 -1
- package/lib/v1/Select/GroupSelect.js +12 -12
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -367,12 +367,16 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
367
367
|
needEffect,
|
|
368
368
|
disabledOptions,
|
|
369
369
|
isLoading,
|
|
370
|
-
dataSelectorId
|
|
370
|
+
dataSelectorId,
|
|
371
|
+
customClass
|
|
371
372
|
} = this.props;
|
|
372
373
|
let {
|
|
373
374
|
SuggestionsProps = {},
|
|
374
375
|
DropBoxProps = {}
|
|
375
376
|
} = customProps;
|
|
377
|
+
let {
|
|
378
|
+
containerClass = ''
|
|
379
|
+
} = customClass;
|
|
376
380
|
const {
|
|
377
381
|
clearText = 'Clear all'
|
|
378
382
|
} = i18nKeys;
|
|
@@ -407,7 +411,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
|
|
|
407
411
|
});
|
|
408
412
|
let isShowClearIcon = !isReadOnly && !isDisabled && isShowClear;
|
|
409
413
|
return /*#__PURE__*/React.createElement("div", {
|
|
410
|
-
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
|
|
414
|
+
className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''} ${containerClass}`,
|
|
411
415
|
"data-id": dataIdMultiSelectComp,
|
|
412
416
|
"data-test-id": dataIdMultiSelectComp,
|
|
413
417
|
"data-title": isDisabled ? title : null,
|
|
@@ -66,7 +66,8 @@ export const AdvancedMultiSelect_defaultProps = {
|
|
|
66
66
|
customProps: {},
|
|
67
67
|
needEffect: true,
|
|
68
68
|
isLoading: false,
|
|
69
|
-
dataSelectorId: 'advancedMultiSelect'
|
|
69
|
+
dataSelectorId: 'advancedMultiSelect',
|
|
70
|
+
customClass: {}
|
|
70
71
|
};
|
|
71
72
|
export const EmptyState_defaultProps = {
|
|
72
73
|
dataId: 'empty',
|
|
@@ -308,5 +308,6 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
|
308
308
|
DropBoxProps: PropTypes.object
|
|
309
309
|
}),
|
|
310
310
|
isLoading: PropTypes.bool,
|
|
311
|
-
dataSelectorId: PropTypes.string
|
|
311
|
+
dataSelectorId: PropTypes.string,
|
|
312
|
+
customClass: PropTypes.object
|
|
312
313
|
};
|
|
@@ -41,7 +41,7 @@ describe('Radio', () => {
|
|
|
41
41
|
}));
|
|
42
42
|
expect(asFragment()).toMatchSnapshot();
|
|
43
43
|
});
|
|
44
|
-
test('rendering the Checked is true',
|
|
44
|
+
test.each(palette)('rendering the Checked is true for palette - %s', palette => {
|
|
45
45
|
const {
|
|
46
46
|
asFragment
|
|
47
47
|
} = render( /*#__PURE__*/React.createElement(Radio, {
|
|
@@ -51,7 +51,7 @@ describe('Radio', () => {
|
|
|
51
51
|
}));
|
|
52
52
|
expect(asFragment()).toMatchSnapshot();
|
|
53
53
|
});
|
|
54
|
-
test('rendering the disabled is true',
|
|
54
|
+
test.each(palette)('rendering the disabled is true for palette - %s', palette => {
|
|
55
55
|
const {
|
|
56
56
|
asFragment
|
|
57
57
|
} = render( /*#__PURE__*/React.createElement(Radio, {
|
|
@@ -218,15 +218,12 @@ describe('Radio', () => {
|
|
|
218
218
|
}));
|
|
219
219
|
expect(asFragment()).toMatchSnapshot();
|
|
220
220
|
});
|
|
221
|
-
test('
|
|
222
|
-
// Create a mock function
|
|
221
|
+
test('getRef prop is a function', () => {
|
|
223
222
|
const mockEleRef = jest.fn();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
} = render( /*#__PURE__*/React.createElement(Radio, {
|
|
227
|
-
eleRef: mockEleRef
|
|
223
|
+
render( /*#__PURE__*/React.createElement(Radio, {
|
|
224
|
+
getRef: mockEleRef
|
|
228
225
|
}));
|
|
229
|
-
expect(
|
|
226
|
+
expect(mockEleRef).toHaveBeenCalled();
|
|
230
227
|
});
|
|
231
228
|
test('renders with different onClick props', () => {
|
|
232
229
|
const onClickFunction = jest.fn();
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Radio eleRef prop is a function 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
aria-checked="false"
|
|
7
|
-
aria-readonly="false"
|
|
8
|
-
class="container pointer hoverEfffect inflex rowdir both"
|
|
9
|
-
data-id="RadioComp"
|
|
10
|
-
data-selector-id="container"
|
|
11
|
-
data-test-id="RadioComp"
|
|
12
|
-
role="radio"
|
|
13
|
-
tabindex="0"
|
|
14
|
-
>
|
|
15
|
-
<div
|
|
16
|
-
class="radio
|
|
17
|
-
hoverprimary medium filled centerPathprimary shrinkOff"
|
|
18
|
-
data-id="boxComponent"
|
|
19
|
-
data-selector-id="box"
|
|
20
|
-
data-test-id="boxComponent"
|
|
21
|
-
>
|
|
22
|
-
<input
|
|
23
|
-
type="hidden"
|
|
24
|
-
value=""
|
|
25
|
-
/>
|
|
26
|
-
<label
|
|
27
|
-
class="radioLabel pointer"
|
|
28
|
-
>
|
|
29
|
-
<svg
|
|
30
|
-
viewBox="0 0 40 40"
|
|
31
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
32
|
-
>
|
|
33
|
-
<circle
|
|
34
|
-
class="rdBox"
|
|
35
|
-
cx="20"
|
|
36
|
-
cy="20"
|
|
37
|
-
r="19"
|
|
38
|
-
/>
|
|
39
|
-
</svg>
|
|
40
|
-
</label>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</DocumentFragment>
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
3
|
exports[`Radio rendering ally ariaChecked true 1`] = `
|
|
47
4
|
<DocumentFragment>
|
|
48
5
|
<div
|
|
@@ -907,7 +864,68 @@ exports[`Radio rendering size - small 1`] = `
|
|
|
907
864
|
</DocumentFragment>
|
|
908
865
|
`;
|
|
909
866
|
|
|
910
|
-
exports[`Radio rendering the Checked is true 1`] = `
|
|
867
|
+
exports[`Radio rendering the Checked is true for palette - danger 1`] = `
|
|
868
|
+
<DocumentFragment>
|
|
869
|
+
<div
|
|
870
|
+
aria-checked="false"
|
|
871
|
+
aria-readonly="false"
|
|
872
|
+
class="container active pointer hoverEfffect flex rowdir both"
|
|
873
|
+
data-id="RadioComp"
|
|
874
|
+
data-selector-id="container"
|
|
875
|
+
data-test-id="RadioComp"
|
|
876
|
+
role="radio"
|
|
877
|
+
tabindex="0"
|
|
878
|
+
>
|
|
879
|
+
<div
|
|
880
|
+
class="radio
|
|
881
|
+
hoverdanger medium filled centerPathdanger shrinkOff"
|
|
882
|
+
data-id="boxComponent"
|
|
883
|
+
data-selector-id="box"
|
|
884
|
+
data-test-id="boxComponent"
|
|
885
|
+
>
|
|
886
|
+
<input
|
|
887
|
+
type="hidden"
|
|
888
|
+
value=""
|
|
889
|
+
/>
|
|
890
|
+
<label
|
|
891
|
+
class="radioLabel pointer"
|
|
892
|
+
>
|
|
893
|
+
<svg
|
|
894
|
+
viewBox="0 0 40 40"
|
|
895
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
896
|
+
>
|
|
897
|
+
<circle
|
|
898
|
+
class="rdBox"
|
|
899
|
+
cx="20"
|
|
900
|
+
cy="20"
|
|
901
|
+
r="19"
|
|
902
|
+
/>
|
|
903
|
+
</svg>
|
|
904
|
+
</label>
|
|
905
|
+
</div>
|
|
906
|
+
<div
|
|
907
|
+
class="text grow basis shrinkOff"
|
|
908
|
+
data-id="boxComponent"
|
|
909
|
+
data-selector-id="box"
|
|
910
|
+
data-test-id="boxComponent"
|
|
911
|
+
>
|
|
912
|
+
<label
|
|
913
|
+
class="label title medium default font_default
|
|
914
|
+
dotted cursor
|
|
915
|
+
dangerLabel pointer "
|
|
916
|
+
data-id="RadioText_label"
|
|
917
|
+
data-selector-id="label"
|
|
918
|
+
data-test-id="RadioText_label"
|
|
919
|
+
data-title="RadioText"
|
|
920
|
+
>
|
|
921
|
+
RadioText
|
|
922
|
+
</label>
|
|
923
|
+
</div>
|
|
924
|
+
</div>
|
|
925
|
+
</DocumentFragment>
|
|
926
|
+
`;
|
|
927
|
+
|
|
928
|
+
exports[`Radio rendering the Checked is true for palette - primary 1`] = `
|
|
911
929
|
<DocumentFragment>
|
|
912
930
|
<div
|
|
913
931
|
aria-checked="false"
|
|
@@ -921,7 +939,7 @@ exports[`Radio rendering the Checked is true 1`] = `
|
|
|
921
939
|
>
|
|
922
940
|
<div
|
|
923
941
|
class="radio
|
|
924
|
-
|
|
942
|
+
hoverprimary medium filled centerPathprimary shrinkOff"
|
|
925
943
|
data-id="boxComponent"
|
|
926
944
|
data-selector-id="box"
|
|
927
945
|
data-test-id="boxComponent"
|
|
@@ -955,7 +973,7 @@ exports[`Radio rendering the Checked is true 1`] = `
|
|
|
955
973
|
<label
|
|
956
974
|
class="label title medium default font_default
|
|
957
975
|
dotted cursor
|
|
958
|
-
|
|
976
|
+
primaryLabel pointer "
|
|
959
977
|
data-id="RadioText_label"
|
|
960
978
|
data-selector-id="label"
|
|
961
979
|
data-test-id="RadioText_label"
|
|
@@ -1459,7 +1477,68 @@ exports[`Radio rendering the defult props 1`] = `
|
|
|
1459
1477
|
</DocumentFragment>
|
|
1460
1478
|
`;
|
|
1461
1479
|
|
|
1462
|
-
exports[`Radio rendering the disabled is true 1`] = `
|
|
1480
|
+
exports[`Radio rendering the disabled is true for palette - danger 1`] = `
|
|
1481
|
+
<DocumentFragment>
|
|
1482
|
+
<div
|
|
1483
|
+
aria-checked="false"
|
|
1484
|
+
aria-readonly="true"
|
|
1485
|
+
class="container disabled flex rowdir both"
|
|
1486
|
+
data-id="RadioComp"
|
|
1487
|
+
data-selector-id="container"
|
|
1488
|
+
data-test-id="RadioComp"
|
|
1489
|
+
role="radio"
|
|
1490
|
+
tabindex="-1"
|
|
1491
|
+
>
|
|
1492
|
+
<div
|
|
1493
|
+
class="radio
|
|
1494
|
+
medium filled centerPathdanger shrinkOff"
|
|
1495
|
+
data-id="boxComponent"
|
|
1496
|
+
data-selector-id="box"
|
|
1497
|
+
data-test-id="boxComponent"
|
|
1498
|
+
>
|
|
1499
|
+
<input
|
|
1500
|
+
type="hidden"
|
|
1501
|
+
value=""
|
|
1502
|
+
/>
|
|
1503
|
+
<label
|
|
1504
|
+
class="radioLabel disabled"
|
|
1505
|
+
>
|
|
1506
|
+
<svg
|
|
1507
|
+
viewBox="0 0 40 40"
|
|
1508
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1509
|
+
>
|
|
1510
|
+
<circle
|
|
1511
|
+
class="rdBox"
|
|
1512
|
+
cx="20"
|
|
1513
|
+
cy="20"
|
|
1514
|
+
r="19"
|
|
1515
|
+
/>
|
|
1516
|
+
</svg>
|
|
1517
|
+
</label>
|
|
1518
|
+
</div>
|
|
1519
|
+
<div
|
|
1520
|
+
class="text grow basis shrinkOff"
|
|
1521
|
+
data-id="boxComponent"
|
|
1522
|
+
data-selector-id="box"
|
|
1523
|
+
data-test-id="boxComponent"
|
|
1524
|
+
>
|
|
1525
|
+
<label
|
|
1526
|
+
class="label title medium default font_default
|
|
1527
|
+
dotted cursor
|
|
1528
|
+
dangerLabel disabled "
|
|
1529
|
+
data-id="RadioText_label"
|
|
1530
|
+
data-selector-id="label"
|
|
1531
|
+
data-test-id="RadioText_label"
|
|
1532
|
+
data-title="RadioText"
|
|
1533
|
+
>
|
|
1534
|
+
RadioText
|
|
1535
|
+
</label>
|
|
1536
|
+
</div>
|
|
1537
|
+
</div>
|
|
1538
|
+
</DocumentFragment>
|
|
1539
|
+
`;
|
|
1540
|
+
|
|
1541
|
+
exports[`Radio rendering the disabled is true for palette - primary 1`] = `
|
|
1463
1542
|
<DocumentFragment>
|
|
1464
1543
|
<div
|
|
1465
1544
|
aria-checked="false"
|
|
@@ -1473,7 +1552,7 @@ exports[`Radio rendering the disabled is true 1`] = `
|
|
|
1473
1552
|
>
|
|
1474
1553
|
<div
|
|
1475
1554
|
class="radio
|
|
1476
|
-
medium filled
|
|
1555
|
+
medium filled centerPathprimary shrinkOff"
|
|
1477
1556
|
data-id="boxComponent"
|
|
1478
1557
|
data-selector-id="box"
|
|
1479
1558
|
data-test-id="boxComponent"
|
|
@@ -1507,7 +1586,7 @@ exports[`Radio rendering the disabled is true 1`] = `
|
|
|
1507
1586
|
<label
|
|
1508
1587
|
class="label title medium default font_default
|
|
1509
1588
|
dotted cursor
|
|
1510
|
-
|
|
1589
|
+
primaryLabel disabled "
|
|
1511
1590
|
data-id="RadioText_label"
|
|
1512
1591
|
data-selector-id="label"
|
|
1513
1592
|
data-test-id="RadioText_label"
|
|
@@ -33,7 +33,7 @@ describe('RippleEffect', () => {
|
|
|
33
33
|
}, /*#__PURE__*/React.createElement("div", null, "RippleEffect")));
|
|
34
34
|
expect(asFragment()).toMatchSnapshot();
|
|
35
35
|
});
|
|
36
|
-
const hoverTypes = ['default', 'border', 'bg'
|
|
36
|
+
const hoverTypes = ['default', 'border', 'bg'];
|
|
37
37
|
test.each(hoverTypes)('rendering hoverType of- %s', hoverType => {
|
|
38
38
|
const {
|
|
39
39
|
asFragment
|
|
@@ -30,16 +30,6 @@ exports[`RippleEffect rendering hoverType of- default 1`] = `
|
|
|
30
30
|
</DocumentFragment>
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
|
-
exports[`RippleEffect rendering hoverType of- test 1`] = `
|
|
34
|
-
<DocumentFragment>
|
|
35
|
-
<div
|
|
36
|
-
class=" effect default border hoverEffect "
|
|
37
|
-
>
|
|
38
|
-
RippleEffect
|
|
39
|
-
</div>
|
|
40
|
-
</DocumentFragment>
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
33
|
exports[`RippleEffect rendering isActive is true 1`] = `
|
|
44
34
|
<DocumentFragment>
|
|
45
35
|
<div
|
package/es/Select/GroupSelect.js
CHANGED
|
@@ -20,7 +20,7 @@ import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
|
20
20
|
import style from './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
|
|
|
@@ -357,7 +357,7 @@ export class GroupSelectComponent extends PureComponent {
|
|
|
357
357
|
let {
|
|
358
358
|
id: selected,
|
|
359
359
|
groupId
|
|
360
|
-
} = extractOptionId(id);
|
|
360
|
+
} = extractOptionId(id) || extractOptionIdFromJson(id, normalizedAllOptions);
|
|
361
361
|
|
|
362
362
|
if (!getIsEmptyValue(id) && !isReadOnly) {
|
|
363
363
|
onChange && onChange({
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tag from '../Tag';
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
describe('Tag component', () => {
|
|
5
|
+
const size = ['small', 'medium'];
|
|
6
|
+
const palette = ['default', 'danger', 'secondary', 'pureDotted', 'primaryDotted', 'dark', 'pureDarkDotted', 'darkPrimaryDotted', 'defaultLink'];
|
|
7
|
+
const closePalette = ['danger', 'primary'];
|
|
8
|
+
test('Should be render with the basic set of default props', () => {
|
|
9
|
+
const {
|
|
10
|
+
asFragment
|
|
11
|
+
} = render( /*#__PURE__*/React.createElement(Tag, null));
|
|
12
|
+
expect(asFragment()).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
test('Should be render imageURL and hasAvatar', () => {
|
|
15
|
+
const {
|
|
16
|
+
asFragment
|
|
17
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
18
|
+
hasAvatar: true,
|
|
19
|
+
imageURL: "https://www.w3schools.com/images/w3schools_green.jpg"
|
|
20
|
+
}));
|
|
21
|
+
expect(asFragment()).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
test('Should be render text', () => {
|
|
24
|
+
const {
|
|
25
|
+
asFragment
|
|
26
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
27
|
+
text: "TagTest"
|
|
28
|
+
}));
|
|
29
|
+
expect(asFragment()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
test('Should be render initial', () => {
|
|
32
|
+
const {
|
|
33
|
+
asFragment
|
|
34
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
35
|
+
hasAvatar: true,
|
|
36
|
+
initial: "avatarIntial"
|
|
37
|
+
}));
|
|
38
|
+
expect(asFragment()).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
test.each(size)('Should render size - %s', size => {
|
|
41
|
+
const {
|
|
42
|
+
asFragment
|
|
43
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
44
|
+
size: size
|
|
45
|
+
}));
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
test.each(size)('Should render onRemove - %s', size => {
|
|
49
|
+
const mockOnRemove = jest.fn();
|
|
50
|
+
const {
|
|
51
|
+
asFragment
|
|
52
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
53
|
+
active: true,
|
|
54
|
+
size: size,
|
|
55
|
+
onRemove: mockOnRemove
|
|
56
|
+
}));
|
|
57
|
+
expect(asFragment()).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
test.each(palette)('Should render active - %s', palette => {
|
|
60
|
+
size.map(sz => {
|
|
61
|
+
closePalette.map(cp => {
|
|
62
|
+
const mockOnRemove = jest.fn();
|
|
63
|
+
const {
|
|
64
|
+
asFragment
|
|
65
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
66
|
+
active: true,
|
|
67
|
+
size: sz,
|
|
68
|
+
palette: palette,
|
|
69
|
+
onRemove: mockOnRemove,
|
|
70
|
+
closePalette: cp
|
|
71
|
+
}));
|
|
72
|
+
expect(asFragment()).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
test('Should be render rounded is false', () => {
|
|
77
|
+
const mockOnRemove = jest.fn();
|
|
78
|
+
const {
|
|
79
|
+
asFragment
|
|
80
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
81
|
+
onRemove: mockOnRemove,
|
|
82
|
+
rounded: false
|
|
83
|
+
}));
|
|
84
|
+
expect(asFragment()).toMatchSnapshot();
|
|
85
|
+
});
|
|
86
|
+
test.each(palette)('Should render palette - %s', palette => {
|
|
87
|
+
const {
|
|
88
|
+
asFragment
|
|
89
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
90
|
+
hasAvatar: true,
|
|
91
|
+
active: true,
|
|
92
|
+
palette: palette
|
|
93
|
+
}));
|
|
94
|
+
expect(asFragment()).toMatchSnapshot();
|
|
95
|
+
});
|
|
96
|
+
test('Should be render disabled is true', () => {
|
|
97
|
+
const {
|
|
98
|
+
asFragment
|
|
99
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
100
|
+
disabled: true
|
|
101
|
+
}));
|
|
102
|
+
expect(asFragment()).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
test('Should be render disabled is false', () => {
|
|
105
|
+
const {
|
|
106
|
+
asFragment
|
|
107
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
108
|
+
disabled: false
|
|
109
|
+
}));
|
|
110
|
+
expect(asFragment()).toMatchSnapshot();
|
|
111
|
+
});
|
|
112
|
+
test.each(closePalette)('Should render closePalette - %s', closePalette => {
|
|
113
|
+
const mockOnRemove = jest.fn();
|
|
114
|
+
const {
|
|
115
|
+
asFragment
|
|
116
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
117
|
+
onRemove: mockOnRemove,
|
|
118
|
+
active: true,
|
|
119
|
+
closePalette: closePalette
|
|
120
|
+
}));
|
|
121
|
+
expect(asFragment()).toMatchSnapshot();
|
|
122
|
+
});
|
|
123
|
+
test('Should be render onSelectTag', () => {
|
|
124
|
+
const mockonSelectTag = jest.fn();
|
|
125
|
+
const {
|
|
126
|
+
asFragment
|
|
127
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
128
|
+
onSelectTag: mockonSelectTag
|
|
129
|
+
}));
|
|
130
|
+
expect(asFragment()).toMatchSnapshot();
|
|
131
|
+
});
|
|
132
|
+
test('Should be render closeTitle', () => {
|
|
133
|
+
const mockOnRemove = jest.fn();
|
|
134
|
+
const {
|
|
135
|
+
asFragment
|
|
136
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
137
|
+
onRemove: mockOnRemove,
|
|
138
|
+
closeTitle: "TagCloseTitle"
|
|
139
|
+
}));
|
|
140
|
+
expect(asFragment()).toMatchSnapshot();
|
|
141
|
+
});
|
|
142
|
+
test('Should be render dataId when active if false', () => {
|
|
143
|
+
const mockOnRemove = jest.fn();
|
|
144
|
+
const {
|
|
145
|
+
asFragment
|
|
146
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
147
|
+
onRemove: mockOnRemove,
|
|
148
|
+
dataId: "TagdataId"
|
|
149
|
+
}));
|
|
150
|
+
expect(asFragment()).toMatchSnapshot();
|
|
151
|
+
});
|
|
152
|
+
test('Should be render dataId when active if true', () => {
|
|
153
|
+
const mockOnRemove = jest.fn();
|
|
154
|
+
const {
|
|
155
|
+
asFragment
|
|
156
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
157
|
+
active: true,
|
|
158
|
+
onRemove: mockOnRemove,
|
|
159
|
+
dataId: "TagdataId"
|
|
160
|
+
}));
|
|
161
|
+
expect(asFragment()).toMatchSnapshot();
|
|
162
|
+
});
|
|
163
|
+
test('Should be render iconName and iconSize', () => {
|
|
164
|
+
const {
|
|
165
|
+
asFragment
|
|
166
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
167
|
+
iconName: "ZD-androidd",
|
|
168
|
+
iconSize: "15"
|
|
169
|
+
}));
|
|
170
|
+
expect(asFragment()).toMatchSnapshot();
|
|
171
|
+
});
|
|
172
|
+
test('Should be render tooltip', () => {
|
|
173
|
+
const {
|
|
174
|
+
asFragment
|
|
175
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
176
|
+
tooltip: "Tagtooltip"
|
|
177
|
+
}));
|
|
178
|
+
expect(asFragment()).toMatchSnapshot();
|
|
179
|
+
});
|
|
180
|
+
test.each(palette)('Should render avatarPalette - %s', palette => {
|
|
181
|
+
const {
|
|
182
|
+
asFragment
|
|
183
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
184
|
+
hasAvatar: true,
|
|
185
|
+
palette: palette,
|
|
186
|
+
avatarPalette: "primary"
|
|
187
|
+
}));
|
|
188
|
+
expect(asFragment()).toMatchSnapshot();
|
|
189
|
+
});
|
|
190
|
+
test('Should be render needEffect is false', () => {
|
|
191
|
+
const {
|
|
192
|
+
asFragment
|
|
193
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
194
|
+
needEffect: false
|
|
195
|
+
}));
|
|
196
|
+
expect(asFragment()).toMatchSnapshot();
|
|
197
|
+
});
|
|
198
|
+
test('Should be render isReadOnly is true', () => {
|
|
199
|
+
const {
|
|
200
|
+
asFragment
|
|
201
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
202
|
+
isReadOnly: true
|
|
203
|
+
}));
|
|
204
|
+
expect(asFragment()).toMatchSnapshot();
|
|
205
|
+
});
|
|
206
|
+
test('rendering the Custom class', () => {
|
|
207
|
+
const mockOnRemove = jest.fn();
|
|
208
|
+
const {
|
|
209
|
+
asFragment
|
|
210
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
211
|
+
onRemove: mockOnRemove,
|
|
212
|
+
iconName: "ZD-androidd",
|
|
213
|
+
hasAvatar: true,
|
|
214
|
+
customClass: {
|
|
215
|
+
customTag: 'customCustomTag',
|
|
216
|
+
customTagClose: 'customCustomTagClose',
|
|
217
|
+
customTagIcon: 'customCustomTagIcon',
|
|
218
|
+
customAvatar: 'customCustomAvatar'
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
expect(asFragment()).toMatchSnapshot();
|
|
222
|
+
});
|
|
223
|
+
test('rendering ally clearLabel', () => {
|
|
224
|
+
const mockOnRemove = jest.fn();
|
|
225
|
+
const {
|
|
226
|
+
asFragment
|
|
227
|
+
} = render( /*#__PURE__*/React.createElement(Tag, {
|
|
228
|
+
onRemove: mockOnRemove,
|
|
229
|
+
a11y: {
|
|
230
|
+
clearLabel: 'TagClearLabel'
|
|
231
|
+
}
|
|
232
|
+
}));
|
|
233
|
+
expect(asFragment()).toMatchSnapshot();
|
|
234
|
+
});
|
|
235
|
+
});
|