@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
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import TextBoxIcon from '../TextBoxIcon';
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
describe('TextBoxIcon component', () => {
|
|
5
|
+
const type = ['text', 'password', 'number'];
|
|
6
|
+
const size = ['small', 'xsmall', 'medium', 'xmedium'];
|
|
7
|
+
const variant = ['primary', 'secondary', 'default'];
|
|
8
|
+
const borderColor = ['transparent', 'default', 'error'];
|
|
9
|
+
test('Should be render with the basic set of default props', () => {
|
|
10
|
+
const {
|
|
11
|
+
asFragment
|
|
12
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, null));
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
test.each(type)('Should render type - %s', type => {
|
|
16
|
+
const {
|
|
17
|
+
asFragment
|
|
18
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
19
|
+
type: type
|
|
20
|
+
}));
|
|
21
|
+
expect(asFragment()).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
test('Should be render name', () => {
|
|
24
|
+
const {
|
|
25
|
+
asFragment
|
|
26
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
27
|
+
name: "TextBoxIconName"
|
|
28
|
+
}));
|
|
29
|
+
expect(asFragment()).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
test('Should be render id', () => {
|
|
32
|
+
const {
|
|
33
|
+
asFragment
|
|
34
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
35
|
+
id: "TextboxIconId"
|
|
36
|
+
}));
|
|
37
|
+
expect(asFragment()).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
test('Should be render placeholder', () => {
|
|
40
|
+
const {
|
|
41
|
+
asFragment
|
|
42
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
43
|
+
placeHolder: "TextBoxIconPlaceHolder"
|
|
44
|
+
}));
|
|
45
|
+
expect(asFragment()).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
test.each(size)('Should render size - %s', size => {
|
|
48
|
+
const {
|
|
49
|
+
asFragment
|
|
50
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
51
|
+
size: size
|
|
52
|
+
}));
|
|
53
|
+
expect(asFragment()).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
test('Should be render isDisabled is true', () => {
|
|
56
|
+
const {
|
|
57
|
+
asFragment
|
|
58
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
59
|
+
isDisabled: true
|
|
60
|
+
}));
|
|
61
|
+
expect(asFragment()).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
test('Should be render isReadOnly is true', () => {
|
|
64
|
+
const {
|
|
65
|
+
asFragment
|
|
66
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
67
|
+
isReadOnly: true
|
|
68
|
+
}));
|
|
69
|
+
expect(asFragment()).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
test('Should be render isReadOnly is true , needEffect is false', () => {
|
|
72
|
+
const {
|
|
73
|
+
asFragment
|
|
74
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
75
|
+
isReadOnly: true,
|
|
76
|
+
needEffect: false
|
|
77
|
+
}));
|
|
78
|
+
expect(asFragment()).toMatchSnapshot();
|
|
79
|
+
});
|
|
80
|
+
test('Should be render children', () => {
|
|
81
|
+
const {
|
|
82
|
+
asFragment
|
|
83
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, null, " ", /*#__PURE__*/React.createElement("div", null, "test"), " "));
|
|
84
|
+
expect(asFragment()).toMatchSnapshot();
|
|
85
|
+
});
|
|
86
|
+
test('Should be render value is string and length greater than 1', () => {
|
|
87
|
+
const mockOnClear = jest.fn();
|
|
88
|
+
const {
|
|
89
|
+
asFragment
|
|
90
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
91
|
+
value: "Text",
|
|
92
|
+
onClear: mockOnClear
|
|
93
|
+
}));
|
|
94
|
+
expect(asFragment()).toMatchSnapshot();
|
|
95
|
+
});
|
|
96
|
+
test('Should be render value is number', () => {
|
|
97
|
+
const mockOnClear = jest.fn();
|
|
98
|
+
const {
|
|
99
|
+
asFragment
|
|
100
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
101
|
+
value: 10,
|
|
102
|
+
onClear: mockOnClear
|
|
103
|
+
}));
|
|
104
|
+
expect(asFragment()).toMatchSnapshot();
|
|
105
|
+
});
|
|
106
|
+
test('Should be render value is string and length less than 1', () => {
|
|
107
|
+
const mockOnClear = jest.fn();
|
|
108
|
+
const {
|
|
109
|
+
asFragment
|
|
110
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
111
|
+
value: "0",
|
|
112
|
+
onClear: mockOnClear
|
|
113
|
+
}));
|
|
114
|
+
expect(asFragment()).toMatchSnapshot();
|
|
115
|
+
});
|
|
116
|
+
test('Should be render iconRotated is true', () => {
|
|
117
|
+
const {
|
|
118
|
+
asFragment
|
|
119
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
120
|
+
iconRotated: true
|
|
121
|
+
}, " ", /*#__PURE__*/React.createElement("div", null, "test"), " "));
|
|
122
|
+
expect(asFragment()).toMatchSnapshot();
|
|
123
|
+
});
|
|
124
|
+
test('Should be render needBorder is false', () => {
|
|
125
|
+
const {
|
|
126
|
+
asFragment
|
|
127
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
128
|
+
needBorder: false
|
|
129
|
+
}));
|
|
130
|
+
expect(asFragment()).toMatchSnapshot();
|
|
131
|
+
});
|
|
132
|
+
test.each(variant)('Should render Varient - %s', variant => {
|
|
133
|
+
const {
|
|
134
|
+
asFragment
|
|
135
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
136
|
+
variant: variant
|
|
137
|
+
}));
|
|
138
|
+
expect(asFragment()).toMatchSnapshot();
|
|
139
|
+
});
|
|
140
|
+
test('Should be render title', () => {
|
|
141
|
+
const {
|
|
142
|
+
asFragment
|
|
143
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
144
|
+
title: "TextBoxIconTitle",
|
|
145
|
+
isDisabled: true
|
|
146
|
+
}));
|
|
147
|
+
expect(asFragment()).toMatchSnapshot();
|
|
148
|
+
});
|
|
149
|
+
test('Should be render needReadOnlyStyle is false', () => {
|
|
150
|
+
const {
|
|
151
|
+
asFragment
|
|
152
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
153
|
+
needReadOnlyStyle: false
|
|
154
|
+
}));
|
|
155
|
+
expect(asFragment()).toMatchSnapshot();
|
|
156
|
+
});
|
|
157
|
+
test('Should be render isClickable is true', () => {
|
|
158
|
+
const {
|
|
159
|
+
asFragment
|
|
160
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
161
|
+
isClickable: true
|
|
162
|
+
}));
|
|
163
|
+
expect(asFragment()).toMatchSnapshot();
|
|
164
|
+
});
|
|
165
|
+
test('Should be render needEffect is false', () => {
|
|
166
|
+
const {
|
|
167
|
+
asFragment
|
|
168
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
169
|
+
isReadOnly: true,
|
|
170
|
+
needEffect: false
|
|
171
|
+
}));
|
|
172
|
+
expect(asFragment()).toMatchSnapshot();
|
|
173
|
+
});
|
|
174
|
+
test.each(borderColor)('Should render borderColor - %s', borderColor => {
|
|
175
|
+
const {
|
|
176
|
+
asFragment
|
|
177
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
178
|
+
borderColor: borderColor
|
|
179
|
+
}));
|
|
180
|
+
expect(asFragment()).toMatchSnapshot();
|
|
181
|
+
});
|
|
182
|
+
test('Should be render showClearIcon is true', () => {
|
|
183
|
+
const {
|
|
184
|
+
asFragment
|
|
185
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
186
|
+
showClearIcon: true
|
|
187
|
+
}));
|
|
188
|
+
expect(asFragment()).toMatchSnapshot();
|
|
189
|
+
});
|
|
190
|
+
test('Should be render htmlId ', () => {
|
|
191
|
+
const {
|
|
192
|
+
asFragment
|
|
193
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
194
|
+
htmlId: "textBoxIconhtmlId"
|
|
195
|
+
}));
|
|
196
|
+
expect(asFragment()).toMatchSnapshot();
|
|
197
|
+
});
|
|
198
|
+
test('Should be render iconOnHover is true , iconOnHover, isDisabled is true ', () => {
|
|
199
|
+
const {
|
|
200
|
+
asFragment
|
|
201
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
202
|
+
iconOnHover: true,
|
|
203
|
+
isReadOnly: true,
|
|
204
|
+
isDisabled: true
|
|
205
|
+
}));
|
|
206
|
+
expect(asFragment()).toMatchSnapshot();
|
|
207
|
+
});
|
|
208
|
+
test('Should be render iconOnHover is true , iconOnHover, isDisabled is false ', () => {
|
|
209
|
+
const {
|
|
210
|
+
asFragment
|
|
211
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
212
|
+
iconOnHover: true,
|
|
213
|
+
isReadOnly: false,
|
|
214
|
+
isDisabled: false
|
|
215
|
+
}));
|
|
216
|
+
expect(asFragment()).toMatchSnapshot();
|
|
217
|
+
});
|
|
218
|
+
test('Should be render isFocus is true ', () => {
|
|
219
|
+
const {
|
|
220
|
+
asFragment
|
|
221
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
222
|
+
isFocus: true,
|
|
223
|
+
isActive: true
|
|
224
|
+
}));
|
|
225
|
+
expect(asFragment()).toMatchSnapshot();
|
|
226
|
+
});
|
|
227
|
+
test('rendering the Custom class', () => {
|
|
228
|
+
const {
|
|
229
|
+
asFragment
|
|
230
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
231
|
+
needBorder: true,
|
|
232
|
+
customClass: {
|
|
233
|
+
customTBoxWrap: 'customTBoxWrapTextBoxIcon',
|
|
234
|
+
customTextBox: 'customTextBoxTextBoxIcon',
|
|
235
|
+
customTBoxIcon: 'customTBoxIconTextBox',
|
|
236
|
+
customTBoxLine: 'customTBoxLineTextBox'
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
expect(asFragment()).toMatchSnapshot();
|
|
240
|
+
});
|
|
241
|
+
test('rendering the Custom Props', () => {
|
|
242
|
+
const {
|
|
243
|
+
asFragment
|
|
244
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
245
|
+
text: "checkboxText",
|
|
246
|
+
customProps: {
|
|
247
|
+
TextBoxProps: {
|
|
248
|
+
'isClickable': 'false'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}));
|
|
252
|
+
expect(asFragment()).toMatchSnapshot();
|
|
253
|
+
});
|
|
254
|
+
test('rendering the i18n value', () => {
|
|
255
|
+
const mockOnClear = jest.fn();
|
|
256
|
+
const i18nKeys = {
|
|
257
|
+
clearText: 'TextBoxIcon Text'
|
|
258
|
+
};
|
|
259
|
+
const {
|
|
260
|
+
asFragment
|
|
261
|
+
} = render( /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
262
|
+
value: "Text",
|
|
263
|
+
onClear: mockOnClear,
|
|
264
|
+
i18nKeys: i18nKeys
|
|
265
|
+
}));
|
|
266
|
+
expect(asFragment()).toMatchSnapshot();
|
|
267
|
+
});
|
|
268
|
+
});
|