@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
package/README.md
CHANGED
|
@@ -32,6 +32,10 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
+
# 1.2.34
|
|
36
|
+
|
|
37
|
+
- **GroupSelect** - When the idField contains more than one underscore symbol, this component throws an error. This issue has been fixed in this version.
|
|
38
|
+
|
|
35
39
|
# 1.2.33
|
|
36
40
|
|
|
37
41
|
- **AdvancedMultiSelect** - customClass prop supported in both normal and v1 folder
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import AppContainer from '../AppContainer.js';
|
|
4
|
+
describe('AppContainer', () => {
|
|
5
|
+
test('rendering the defult props', () => {
|
|
6
|
+
const {
|
|
7
|
+
asFragment
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, null));
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('rendering the customClass', () => {
|
|
12
|
+
const {
|
|
13
|
+
asFragment
|
|
14
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
15
|
+
className: "AppcontainerClass"
|
|
16
|
+
}));
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
test('rendering the needTooltip is false', () => {
|
|
20
|
+
const {
|
|
21
|
+
asFragment
|
|
22
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
23
|
+
needTooltip: false
|
|
24
|
+
}));
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
test('rendering the tooltipClass', () => {
|
|
28
|
+
const {
|
|
29
|
+
asFragment
|
|
30
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
31
|
+
tooltipClass: "customTooltipClass"
|
|
32
|
+
}));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('rendering the tooltipParentClass', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
39
|
+
tooltipParentClass: "tooltipParentClass"
|
|
40
|
+
}));
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
test('rendering the Custom props', () => {
|
|
44
|
+
const {
|
|
45
|
+
asFragment
|
|
46
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
47
|
+
customProps: {
|
|
48
|
+
ExtraProps: {
|
|
49
|
+
'data-props': true
|
|
50
|
+
},
|
|
51
|
+
ContainerProps: {
|
|
52
|
+
'data-container': true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
expect(asFragment()).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
test('eleRef prop is a function', () => {
|
|
59
|
+
const mockEleRef = jest.fn();
|
|
60
|
+
render( /*#__PURE__*/React.createElement(AppContainer, {
|
|
61
|
+
eleRef: mockEleRef
|
|
62
|
+
}));
|
|
63
|
+
expect(mockEleRef).toHaveBeenCalled();
|
|
64
|
+
});
|
|
65
|
+
test('rendering the childern as element', () => {
|
|
66
|
+
const {
|
|
67
|
+
asFragment
|
|
68
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", null, "Children")));
|
|
69
|
+
expect(asFragment()).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
test('rendering the childern as element in array', () => {
|
|
72
|
+
const children = [/*#__PURE__*/React.createElement("div", {
|
|
73
|
+
key: "child1"
|
|
74
|
+
}, "Child 1"), /*#__PURE__*/React.createElement("span", {
|
|
75
|
+
key: "child2"
|
|
76
|
+
}, "Child 2")];
|
|
77
|
+
const {
|
|
78
|
+
asFragment
|
|
79
|
+
} = render( /*#__PURE__*/React.createElement(AppContainer, null, children));
|
|
80
|
+
expect(asFragment()).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -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
|
+
`;
|
|
@@ -98,25 +98,12 @@ describe('Button component', () => {
|
|
|
98
98
|
}
|
|
99
99
|
}));
|
|
100
100
|
expect(asFragment()).toMatchSnapshot();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}));
|
|
110
|
-
expect(asFragment()).toMatchSnapshot();
|
|
111
|
-
});
|
|
112
|
-
test('Should be render with the customstyle with medium ', () => {
|
|
113
|
-
const {
|
|
114
|
-
asFragment
|
|
115
|
-
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
116
|
-
customStyle: {
|
|
117
|
-
$medium: "buttonMedium"
|
|
118
|
-
}
|
|
119
|
-
}));
|
|
120
|
-
expect(asFragment()).toMatchSnapshot();
|
|
121
|
-
});
|
|
101
|
+
}); // test('Should be render with the basic set customstyle ', () => {
|
|
102
|
+
// const { asFragment } = render(<Button customStyle={{bold: "buttonBold"}} />);
|
|
103
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
104
|
+
// });
|
|
105
|
+
// test('Should be render with the customstyle with medium ', () => {
|
|
106
|
+
// const { asFragment } = render(<Button customStyle={{$medium: "buttonMedium"}} />);
|
|
107
|
+
// expect(asFragment()).toMatchSnapshot();
|
|
108
|
+
// });
|
|
122
109
|
});
|
|
@@ -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,240 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CheckBox from '../CheckBox';
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
describe('CheckBox component', () => {
|
|
5
|
+
test('Should be render with the basic set of default props', () => {
|
|
6
|
+
const {
|
|
7
|
+
asFragment
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, null));
|
|
9
|
+
expect(asFragment()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('Should be render ID', () => {
|
|
12
|
+
const {
|
|
13
|
+
asFragment
|
|
14
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
15
|
+
id: "checkBoxId",
|
|
16
|
+
text: "checkBoxText"
|
|
17
|
+
}));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
const palette = ['primary', 'danger'];
|
|
21
|
+
test.each(palette)('Should render palette and checkbox with checked - %s', palette => {
|
|
22
|
+
const {
|
|
23
|
+
asFragment
|
|
24
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
25
|
+
checked: true,
|
|
26
|
+
palette: palette,
|
|
27
|
+
text: "checkBoxTest",
|
|
28
|
+
active: true
|
|
29
|
+
}));
|
|
30
|
+
expect(asFragment()).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
test('Should be disable', () => {
|
|
33
|
+
const {
|
|
34
|
+
asFragment
|
|
35
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
36
|
+
disabled: true,
|
|
37
|
+
checked: true,
|
|
38
|
+
text: "checkboxDisable"
|
|
39
|
+
}));
|
|
40
|
+
expect(asFragment()).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
test('Should be isReadOnly', () => {
|
|
43
|
+
const {
|
|
44
|
+
asFragment
|
|
45
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
46
|
+
isReadOnly: true
|
|
47
|
+
}));
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
test('Should be render disabledTitle and title', () => {
|
|
51
|
+
const {
|
|
52
|
+
asFragment
|
|
53
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
54
|
+
disabled: true,
|
|
55
|
+
disabledTitle: "checkBoxdisableTitle",
|
|
56
|
+
text: "CheckBoxdisabledTitle",
|
|
57
|
+
title: "checkBoxTitle"
|
|
58
|
+
}));
|
|
59
|
+
expect(asFragment()).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
test('Should be render title', () => {
|
|
62
|
+
const {
|
|
63
|
+
asFragment
|
|
64
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
65
|
+
text: "CheckBoxdisabledTitle",
|
|
66
|
+
title: "checkBoxTitle"
|
|
67
|
+
}));
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
test('Should be render text', () => {
|
|
71
|
+
const {
|
|
72
|
+
asFragment
|
|
73
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
74
|
+
text: "CheckBoxdisabledTitle"
|
|
75
|
+
}));
|
|
76
|
+
expect(asFragment()).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
const size = ['small', 'medium'];
|
|
79
|
+
test.each(size)('Should render size - %s', size => {
|
|
80
|
+
const {
|
|
81
|
+
asFragment
|
|
82
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
83
|
+
checked: true,
|
|
84
|
+
size: size
|
|
85
|
+
}));
|
|
86
|
+
expect(asFragment()).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
const labelPalette = ['default', 'primary', 'secondary', 'danger', 'mandatory'];
|
|
89
|
+
test.each(labelPalette)('Should render size - %s', labelPalette => {
|
|
90
|
+
const {
|
|
91
|
+
asFragment
|
|
92
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
93
|
+
text: "checkboxText",
|
|
94
|
+
labelPalette: labelPalette
|
|
95
|
+
}));
|
|
96
|
+
expect(asFragment()).toMatchSnapshot();
|
|
97
|
+
});
|
|
98
|
+
const labelSize = ['small', 'medium', 'large'];
|
|
99
|
+
test.each(labelSize)('Should render labelSize - %s', labelSize => {
|
|
100
|
+
const {
|
|
101
|
+
asFragment
|
|
102
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
103
|
+
text: "checkboxText",
|
|
104
|
+
labelSize: labelSize
|
|
105
|
+
}));
|
|
106
|
+
expect(asFragment()).toMatchSnapshot();
|
|
107
|
+
});
|
|
108
|
+
test('Should be render isFilled', () => {
|
|
109
|
+
const {
|
|
110
|
+
asFragment
|
|
111
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
112
|
+
isFilled: true
|
|
113
|
+
}));
|
|
114
|
+
expect(asFragment()).toMatchSnapshot();
|
|
115
|
+
});
|
|
116
|
+
test('Should be render isClipped is false', () => {
|
|
117
|
+
const {
|
|
118
|
+
asFragment
|
|
119
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
120
|
+
isClipped: false
|
|
121
|
+
}));
|
|
122
|
+
expect(asFragment()).toMatchSnapshot();
|
|
123
|
+
});
|
|
124
|
+
test('eleRef prop is a function', () => {
|
|
125
|
+
// Create a mock function
|
|
126
|
+
const mockEleRef = jest.fn();
|
|
127
|
+
const {
|
|
128
|
+
asFragment
|
|
129
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
130
|
+
getRef: mockEleRef
|
|
131
|
+
}));
|
|
132
|
+
expect(mockEleRef).toHaveBeenCalled();
|
|
133
|
+
});
|
|
134
|
+
const variant = ['default', 'primary'];
|
|
135
|
+
test.each(variant)('Should render labelSize - %s', variant => {
|
|
136
|
+
const {
|
|
137
|
+
asFragment
|
|
138
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
139
|
+
text: "checkboxText",
|
|
140
|
+
variant: variant
|
|
141
|
+
}));
|
|
142
|
+
expect(asFragment()).toMatchSnapshot();
|
|
143
|
+
});
|
|
144
|
+
test.each(palette)('Should render active - %s', palette => {
|
|
145
|
+
const {
|
|
146
|
+
asFragment
|
|
147
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
148
|
+
text: "checkboxText",
|
|
149
|
+
checked: true,
|
|
150
|
+
active: true,
|
|
151
|
+
palette: palette
|
|
152
|
+
}));
|
|
153
|
+
expect(asFragment()).toMatchSnapshot();
|
|
154
|
+
});
|
|
155
|
+
test('Should be render name', () => {
|
|
156
|
+
const {
|
|
157
|
+
asFragment
|
|
158
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
159
|
+
name: "checkBoxName"
|
|
160
|
+
}));
|
|
161
|
+
expect(asFragment()).toMatchSnapshot();
|
|
162
|
+
});
|
|
163
|
+
test('Should be render activeStyle is minus', () => {
|
|
164
|
+
const {
|
|
165
|
+
asFragment
|
|
166
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
167
|
+
activeStyle: "minus"
|
|
168
|
+
}));
|
|
169
|
+
expect(asFragment()).toMatchSnapshot();
|
|
170
|
+
});
|
|
171
|
+
test('Should be render dataSelectorId', () => {
|
|
172
|
+
const {
|
|
173
|
+
asFragment
|
|
174
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
175
|
+
dataSelectorId: "dataSelectorIdCheck"
|
|
176
|
+
}));
|
|
177
|
+
expect(asFragment()).toMatchSnapshot();
|
|
178
|
+
});
|
|
179
|
+
test('rendering the Custom Props', () => {
|
|
180
|
+
const {
|
|
181
|
+
asFragment
|
|
182
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
183
|
+
text: "checkboxText",
|
|
184
|
+
customProps: {
|
|
185
|
+
CheckBoxProps: {
|
|
186
|
+
'data-props': true
|
|
187
|
+
},
|
|
188
|
+
LabelProps: {
|
|
189
|
+
'customClass': 'checkBoxCustomClass'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
expect(asFragment()).toMatchSnapshot();
|
|
194
|
+
});
|
|
195
|
+
test('rendering the Custom class', () => {
|
|
196
|
+
const {
|
|
197
|
+
asFragment
|
|
198
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
199
|
+
text: "checkboxText",
|
|
200
|
+
checked: true,
|
|
201
|
+
customClass: {
|
|
202
|
+
customCheckBox: 'customCheckBoxClass',
|
|
203
|
+
customLabel: 'customLabelClass',
|
|
204
|
+
customCBoxSize: 'customCBoxSizeClass',
|
|
205
|
+
customTickSize: 'customTickSizeClass'
|
|
206
|
+
}
|
|
207
|
+
}));
|
|
208
|
+
expect(asFragment()).toMatchSnapshot();
|
|
209
|
+
});
|
|
210
|
+
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role true and entering their values', () => {
|
|
211
|
+
const {
|
|
212
|
+
asFragment
|
|
213
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
214
|
+
checked: true,
|
|
215
|
+
a11y: {
|
|
216
|
+
ariaLabel: 'ariaLabelCheckBox',
|
|
217
|
+
ariaLabelledby: 'ariaLabelledbyCheckBox',
|
|
218
|
+
ariaChecked: true,
|
|
219
|
+
ariaHidden: true,
|
|
220
|
+
role: 'checkBox2'
|
|
221
|
+
}
|
|
222
|
+
}));
|
|
223
|
+
expect(asFragment()).toMatchSnapshot();
|
|
224
|
+
});
|
|
225
|
+
test('rendering ally ariaLabel , ariaLabelledby, ariaHidden,ariaChecked,role false and entering their values', () => {
|
|
226
|
+
const {
|
|
227
|
+
asFragment
|
|
228
|
+
} = render( /*#__PURE__*/React.createElement(CheckBox, {
|
|
229
|
+
checked: true,
|
|
230
|
+
a11y: {
|
|
231
|
+
ariaLabel: 'ariaLabelCheckBox',
|
|
232
|
+
ariaLabelledby: 'ariaLabelledbyCheckBox',
|
|
233
|
+
ariaChecked: false,
|
|
234
|
+
ariaHidden: false,
|
|
235
|
+
role: 'checkBox3'
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
238
|
+
expect(asFragment()).toMatchSnapshot();
|
|
239
|
+
});
|
|
240
|
+
});
|