@innovaccer/design-system 2.5.0-2 → 2.5.1
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/.all-contributorsrc +170 -0
- package/.github/workflows/jira.yml +1 -2
- package/.github/workflows/main.yml +1 -6
- package/.github/workflows/test.yml +22 -0
- package/CHANGELOG.md +21 -54
- package/CONTRIBUTING.md +23 -0
- package/README.md +124 -75
- package/core/components/atoms/button/Button.tsx +56 -55
- package/core/components/atoms/button/__tests__/Button.test.tsx +3 -12
- package/core/components/atoms/checkbox/Checkbox.tsx +3 -6
- package/core/components/atoms/collapsible/__stories__/index.story.tsx +2 -2
- package/core/components/atoms/dropdown/DropdownList.tsx +1 -1
- package/core/components/atoms/dropdown/__stories__/Options.tsx +15 -0
- package/core/components/atoms/dropdown/__tests__/Dropdown.test.tsx +202 -1
- package/core/components/atoms/dropdown/__tests__/Option.test.tsx +3 -0
- package/core/components/atoms/message/__stories__/CustomDescription.tsx +25 -0
- package/core/components/atoms/metaList/Meta.tsx +3 -1
- package/core/components/atoms/metaList/__tests__/MetaList.test.tsx +30 -36
- package/core/components/atoms/metricInput/MetricInput.tsx +2 -2
- package/core/components/atoms/outsideClick/__stories__/index.story.tsx +1 -1
- package/core/components/atoms/radio/Radio.tsx +7 -10
- package/core/components/atoms/radio/__tests__/Radio.test.tsx +13 -7
- package/core/components/css-utilities/Align/Align.story.tsx +1 -1
- package/core/components/css-utilities/Background/Background.story.tsx +1 -1
- package/core/components/css-utilities/Border/Border.story.tsx +128 -0
- package/core/components/css-utilities/Display/Display.story.tsx +1 -1
- package/core/components/css-utilities/Flex/Flex.story.tsx +1 -1
- package/core/components/css-utilities/Miscellaneous/Miscellaneous.story.tsx +1 -1
- package/core/components/css-utilities/Overflow/Overflow.story.tsx +1 -1
- package/core/components/css-utilities/Position/Position.story.tsx +1 -1
- package/core/components/css-utilities/Sizing/Sizing.story.tsx +1 -1
- package/core/components/css-utilities/Spacing/Spacing.story.tsx +1 -1
- package/core/components/molecules/chatMessage/__tests__/ChatMessage.test.tsx +20 -46
- package/core/components/molecules/dropzone/__tests__/Dropzone.test.tsx +47 -111
- package/core/components/molecules/dropzone/__tests__/Utilities.test.tsx +13 -13
- package/core/components/molecules/editableChipInput/EditableChipInput.tsx +3 -1
- package/core/components/molecules/editableInput/EditableInput.tsx +5 -3
- package/core/components/molecules/editableInput/__stories__/variants/Uncontrolled.story.tsx +1 -1
- package/core/components/molecules/editableInput/__tests__/EditableInput.test.tsx +1 -3
- package/core/components/molecules/emptyState/_tests_/EmptyState.test.tsx +3 -7
- package/core/components/molecules/fileUploader/FileUploaderItem.tsx +13 -2
- package/core/components/molecules/fileUploader/__stories__/index.story.tsx +156 -21
- package/core/components/molecules/fileUploader/__tests__/FileUploader.test.tsx +21 -80
- package/core/components/molecules/fileUploader/__tests__/FileUploaderList.test.tsx +9 -40
- package/core/components/molecules/fullscreenModal/FullscreenModal.tsx +7 -13
- package/core/components/molecules/fullscreenModal/__stories__/Layering.story.tsx +2 -2
- package/core/components/molecules/modal/Modal.tsx +18 -17
- package/core/components/molecules/modal/ModalBody.tsx +1 -1
- package/core/components/molecules/modal/__stories__/Layering.story.tsx +1 -1
- package/core/components/molecules/modal/__stories__/NoFooter.story.tsx +0 -1
- package/core/components/molecules/modal/__stories__/Scrolling.story.tsx +20 -38
- package/core/components/molecules/modal/__tests__/Modal.test.tsx +1 -1
- package/core/components/molecules/sidesheet/Sidesheet.tsx +16 -17
- package/core/components/organisms/choiceList/ChoiceList.tsx +212 -0
- package/core/components/organisms/choiceList/__stories__/Alignment.story.tsx +32 -0
- package/core/components/organisms/choiceList/__stories__/AllowMultiple.story.tsx +23 -0
- package/core/components/organisms/choiceList/__stories__/Controlled.story.tsx +34 -0
- package/core/components/organisms/choiceList/__stories__/index.story.tsx +18 -0
- package/core/components/organisms/choiceList/__tests__/ChoiceList.test.tsx +155 -0
- package/core/components/organisms/choiceList/__tests__/__snapshots__/ChoiceList.test.tsx.snap +3393 -0
- package/core/components/organisms/choiceList/index.tsx +2 -0
- package/core/components/organisms/datePicker/__tests__/DatePicker.test.tsx +136 -46
- package/core/components/organisms/datePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +2594 -102
- package/core/components/organisms/dateRangePicker/DateRangePicker.tsx +5 -0
- package/core/components/organisms/dateRangePicker/__tests__/DateRangePicker.test.tsx +49 -410
- package/core/components/organisms/dateRangePicker/__tests__/Utilities.test.tsx +39 -0
- package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +45390 -2679
- package/core/components/organisms/dateRangePicker/utilities.tsx +2 -5
- package/core/components/organisms/grid/Cell.tsx +5 -4
- package/core/components/organisms/grid/Grid.tsx +1 -1
- package/core/components/organisms/grid/GridCell.tsx +18 -7
- package/core/components/organisms/grid/GridHead.tsx +1 -1
- package/core/components/organisms/grid/GridRow.tsx +5 -12
- package/core/components/organisms/grid/__tests__/Grid.test.tsx +179 -1
- package/core/components/organisms/grid/__tests__/GridCell.test.tsx +218 -0
- package/core/components/organisms/grid/__tests__/__snapshots__/Grid.test.tsx.snap +1024 -0
- package/core/components/organisms/grid/__tests__/rowUtility.test.tsx +62 -0
- package/core/components/organisms/inlineMessage/InlineMessage.tsx +10 -14
- package/core/components/organisms/inlineMessage/__stories__/InlineMessageWithinTable.story.tsx +9 -12
- package/core/components/organisms/inlineMessage/__stories__/variants/Default.story.tsx +2 -4
- package/core/components/organisms/inlineMessage/__stories__/variants/Error.story.tsx +2 -5
- package/core/components/organisms/inlineMessage/__stories__/variants/Info.story.tsx +2 -5
- package/core/components/organisms/inlineMessage/__stories__/variants/Success.story.tsx +2 -5
- package/core/components/organisms/inlineMessage/__stories__/variants/Warning.story.tsx +2 -5
- package/core/components/organisms/inlineMessage/__tests__/InlineMessage.test.tsx +4 -20
- package/core/components/organisms/navigation/VerticalNavigation.tsx +14 -3
- package/core/components/organisms/navigation/__tests__/Navigation.test.tsx +179 -0
- package/core/components/organisms/navigation/__tests__/__snapshots__/Navigation.test.tsx.snap +530 -0
- package/core/components/organisms/table/DraggableDropdown.tsx +1 -0
- package/core/components/organisms/table/Header.tsx +11 -2
- package/core/components/organisms/table/Table.tsx +2 -2
- package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +4 -1
- package/core/components/organisms/table/__stories__/variants/nestedRows.story.tsx +5 -2
- package/core/components/organisms/table/__tests__/Table.test.tsx +292 -0
- package/core/components/organisms/table/__tests__/__snapshots__/Table.test.tsx.snap +349041 -0
- package/core/components/organisms/timePicker/__tests__/TimePicker.test.tsx +15 -66
- package/core/components/patterns/dateRangePicker/withCustomPopover.story.tsx +47 -36
- package/core/index.tsx +1 -1
- package/core/index.type.tsx +1 -0
- package/core/utils/OverlayManager.tsx +1 -3
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +4 -0
- package/core/utils/types.tsx +3 -4
- package/css/dist/index.css +78 -8
- package/css/dist/index.css.map +1 -1
- package/css/src/components/button.css +8 -4
- package/css/src/components/choiceList.css +25 -0
- package/css/src/components/modal.css +1 -2
- package/css/src/utils/border.css +39 -0
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +50 -49
- package/dist/core/components/css-utilities/Border/Border.story.d.ts +13 -0
- package/dist/core/components/organisms/choiceList/ChoiceList.d.ts +33 -0
- package/dist/core/components/organisms/choiceList/index.d.ts +2 -0
- package/dist/core/components/organisms/dateRangePicker/utilities.d.ts +2 -2
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.type.d.ts +1 -0
- package/dist/index.esm.js +207 -58
- package/dist/index.js +209 -57
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/jest.config.js +2 -1
- package/package.json +6 -4
|
@@ -232,6 +232,11 @@ export class DateRangePicker extends React.Component<DateRangePickerProps, DateR
|
|
|
232
232
|
else onRangeChange(undefined, undefined, sValue, eValue);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
if (this.state.startDate && this.state.endDate) {
|
|
236
|
+
this.setState({
|
|
237
|
+
open: !this.state.open,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
|
|
@@ -11,298 +11,29 @@ const booleanValue = [true, false];
|
|
|
11
11
|
const size: Size[] = ['large', 'small'];
|
|
12
12
|
const alignPosition = ['left', 'right'];
|
|
13
13
|
const numArray = [1, 2, 3];
|
|
14
|
-
const position = ['bottom',
|
|
15
|
-
'top',
|
|
16
|
-
'top-start',
|
|
17
|
-
'top-end',
|
|
18
|
-
'bottom-start',
|
|
19
|
-
'bottom-end',
|
|
20
|
-
'left',
|
|
21
|
-
'right'
|
|
22
|
-
];
|
|
14
|
+
const position = ['bottom', 'top', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left', 'right'];
|
|
23
15
|
const caption = 'testing caption';
|
|
24
16
|
const currentDate = new Date(2021, 8, 12);
|
|
25
17
|
const startDate = new Date(2020, 2, 3);
|
|
26
18
|
const endDate = new Date(2021, 5, 8);
|
|
27
19
|
const dateFormat = [currentDate, 1629790081880];
|
|
28
|
-
const inputFormat = ['mm/dd/yyyy',
|
|
29
|
-
'dd/mm/yyyy',
|
|
30
|
-
'yyyy/mm/dd',
|
|
31
|
-
'mm-dd-yyyy',
|
|
32
|
-
'dd-mm-yyyy',
|
|
33
|
-
'yyyy-mm-dd'
|
|
34
|
-
];
|
|
20
|
+
const inputFormat = ['mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy/mm/dd', 'mm-dd-yyyy', 'dd-mm-yyyy', 'yyyy-mm-dd'];
|
|
35
21
|
const FunctionValue = jest.fn();
|
|
36
22
|
|
|
37
23
|
describe('DateRangePicker component', () => {
|
|
38
24
|
const mapper: Record<string, any> = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
43
|
-
const attr = filterUndefined(props) as Props;
|
|
44
|
-
|
|
45
|
-
it(testMessageHelper(attr), () => {
|
|
46
|
-
const { baseElement } = render(
|
|
47
|
-
<DateRangePicker
|
|
48
|
-
startDate={startDate}
|
|
49
|
-
endDate={endDate}
|
|
50
|
-
{...attr}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
expect(baseElement).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
testHelper(mapper, testFunc);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe('DateRangePicker component', () => {
|
|
61
|
-
const mapper: Record<string, any> = {
|
|
62
|
-
monthsInView: valueHelper(numArray, { required: true, iterate: true }),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
66
|
-
const attr = filterUndefined(props) as Props;
|
|
67
|
-
|
|
68
|
-
it(testMessageHelper(attr), () => {
|
|
69
|
-
const { baseElement } = render(
|
|
70
|
-
<DateRangePicker
|
|
71
|
-
startDate={startDate}
|
|
72
|
-
endDate={endDate}
|
|
73
|
-
{...attr}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
expect(baseElement).toMatchSnapshot();
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
testHelper(mapper, testFunc);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('DateRangePicker component', () => {
|
|
84
|
-
const mapper: Record<string, any> = {
|
|
25
|
+
open: valueHelper(booleanValue, { required: true, iterate: true }),
|
|
26
|
+
size: valueHelper(size, { required: true, iterate: true }),
|
|
27
|
+
withInput: valueHelper(booleanValue, { required: true, iterate: true }),
|
|
85
28
|
rangeLimit: valueHelper(7, { required: true }),
|
|
29
|
+
view: valueHelper(view, { required: true, iterate: true }),
|
|
86
30
|
};
|
|
87
31
|
|
|
88
32
|
const testFunc = (props: Record<string, any>): void => {
|
|
89
33
|
const attr = filterUndefined(props) as Props;
|
|
90
34
|
|
|
91
35
|
it(testMessageHelper(attr), () => {
|
|
92
|
-
const { baseElement } = render(
|
|
93
|
-
<DateRangePicker
|
|
94
|
-
startDate={startDate}
|
|
95
|
-
endDate={endDate}
|
|
96
|
-
{...attr}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
expect(baseElement).toMatchSnapshot();
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
testHelper(mapper, testFunc);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe('DateRangePicker component', () => {
|
|
107
|
-
const mapper: Record<string, any> = {
|
|
108
|
-
withInput: valueHelper(booleanValue, { required: true, iterate: true })
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
112
|
-
const attr = filterUndefined(props) as Props;
|
|
113
|
-
|
|
114
|
-
it(testMessageHelper(attr), () => {
|
|
115
|
-
const { baseElement } = render(
|
|
116
|
-
<DateRangePicker
|
|
117
|
-
startDate={startDate}
|
|
118
|
-
endDate={endDate}
|
|
119
|
-
{...attr}
|
|
120
|
-
/>
|
|
121
|
-
);
|
|
122
|
-
expect(baseElement).toMatchSnapshot();
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
testHelper(mapper, testFunc);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
describe('DateRangePicker component', () => {
|
|
130
|
-
const mapper: Record<string, any> = {
|
|
131
|
-
open: valueHelper(booleanValue, { required: true, iterate: true })
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
135
|
-
const attr = filterUndefined(props) as Props;
|
|
136
|
-
|
|
137
|
-
it(testMessageHelper(attr), () => {
|
|
138
|
-
const { baseElement } = render(
|
|
139
|
-
<DateRangePicker
|
|
140
|
-
startDate={startDate}
|
|
141
|
-
endDate={endDate}
|
|
142
|
-
{...attr}
|
|
143
|
-
/>
|
|
144
|
-
);
|
|
145
|
-
expect(baseElement).toMatchSnapshot();
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
testHelper(mapper, testFunc);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
describe('DateRangePicker component', () => {
|
|
153
|
-
const mapper: Record<string, any> = {
|
|
154
|
-
size: valueHelper(size, { required: true, iterate: true })
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
158
|
-
const attr = filterUndefined(props) as Props;
|
|
159
|
-
|
|
160
|
-
it(testMessageHelper(attr), () => {
|
|
161
|
-
const { baseElement } = render(
|
|
162
|
-
<DateRangePicker
|
|
163
|
-
startDate={startDate}
|
|
164
|
-
endDate={endDate}
|
|
165
|
-
{...attr}
|
|
166
|
-
/>
|
|
167
|
-
);
|
|
168
|
-
expect(baseElement).toMatchSnapshot();
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
testHelper(mapper, testFunc);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe('DateRangePicker component', () => {
|
|
176
|
-
const mapper: Record<string, any> = {
|
|
177
|
-
jumpView: valueHelper(booleanValue, { required: true, iterate: true })
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
181
|
-
const attr = filterUndefined(props) as Props;
|
|
182
|
-
|
|
183
|
-
it(testMessageHelper(attr), () => {
|
|
184
|
-
const { baseElement } = render(
|
|
185
|
-
<DateRangePicker
|
|
186
|
-
startDate={startDate}
|
|
187
|
-
endDate={endDate}
|
|
188
|
-
{...attr}
|
|
189
|
-
/>
|
|
190
|
-
);
|
|
191
|
-
expect(baseElement).toMatchSnapshot();
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
testHelper(mapper, testFunc);
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
describe('DateRangePicker component', () => {
|
|
199
|
-
const mapper: Record<string, any> = {
|
|
200
|
-
firstDayOfWeek: valueHelper(weeksList, { required: true, iterate: true })
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
204
|
-
const attr = filterUndefined(props) as Props;
|
|
205
|
-
|
|
206
|
-
it(testMessageHelper(attr), () => {
|
|
207
|
-
const { baseElement } = render(
|
|
208
|
-
<DateRangePicker
|
|
209
|
-
startDate={startDate}
|
|
210
|
-
endDate={endDate}
|
|
211
|
-
{...attr}
|
|
212
|
-
/>
|
|
213
|
-
);
|
|
214
|
-
expect(baseElement).toMatchSnapshot();
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
testHelper(mapper, testFunc);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
describe('DateRangePicker component', () => {
|
|
222
|
-
const mapper: Record<string, any> = {
|
|
223
|
-
disabledBefore: valueHelper(dateFormat[1], { required: true })
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
227
|
-
const attr = filterUndefined(props) as Props;
|
|
228
|
-
|
|
229
|
-
it(testMessageHelper(attr), () => {
|
|
230
|
-
const { baseElement } = render(
|
|
231
|
-
<DateRangePicker
|
|
232
|
-
startDate={startDate}
|
|
233
|
-
endDate={endDate}
|
|
234
|
-
{...attr}
|
|
235
|
-
/>
|
|
236
|
-
);
|
|
237
|
-
expect(baseElement).toMatchSnapshot();
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
testHelper(mapper, testFunc);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
describe('DateRangePicker component', () => {
|
|
245
|
-
const mapper: Record<string, any> = {
|
|
246
|
-
disabledAfter: valueHelper(dateFormat[1], { required: true })
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
250
|
-
const attr = filterUndefined(props) as Props;
|
|
251
|
-
|
|
252
|
-
it(testMessageHelper(attr), () => {
|
|
253
|
-
const { baseElement } = render(
|
|
254
|
-
<DateRangePicker
|
|
255
|
-
startDate={startDate}
|
|
256
|
-
endDate={endDate}
|
|
257
|
-
{...attr}
|
|
258
|
-
/>
|
|
259
|
-
);
|
|
260
|
-
expect(baseElement).toMatchSnapshot();
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
testHelper(mapper, testFunc);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
describe('DateRangePicker component', () => {
|
|
268
|
-
const mapper: Record<string, any> = {
|
|
269
|
-
yearNav: valueHelper(numArray, { required: true, iterate: true })
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
273
|
-
const attr = filterUndefined(props) as Props;
|
|
274
|
-
|
|
275
|
-
it(testMessageHelper(attr), () => {
|
|
276
|
-
const { baseElement } = render(
|
|
277
|
-
<DateRangePicker
|
|
278
|
-
startDate={startDate}
|
|
279
|
-
endDate={endDate}
|
|
280
|
-
{...attr}
|
|
281
|
-
/>
|
|
282
|
-
);
|
|
283
|
-
expect(baseElement).toMatchSnapshot();
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
testHelper(mapper, testFunc);
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
describe('DateRangePicker component', () => {
|
|
291
|
-
const mapper: Record<string, any> = {
|
|
292
|
-
monthNav: valueHelper(numArray, { required: true, iterate: true })
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
const testFunc = (props: Record<string, any>): void => {
|
|
296
|
-
const attr = filterUndefined(props) as Props;
|
|
297
|
-
|
|
298
|
-
it(testMessageHelper(attr), () => {
|
|
299
|
-
const { baseElement } = render(
|
|
300
|
-
<DateRangePicker
|
|
301
|
-
startDate={startDate}
|
|
302
|
-
endDate={endDate}
|
|
303
|
-
{...attr}
|
|
304
|
-
/>
|
|
305
|
-
);
|
|
36
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
306
37
|
expect(baseElement).toMatchSnapshot();
|
|
307
38
|
});
|
|
308
39
|
};
|
|
@@ -312,20 +43,14 @@ describe('DateRangePicker component', () => {
|
|
|
312
43
|
|
|
313
44
|
describe('DateRangePicker component', () => {
|
|
314
45
|
const mapper: Record<string, any> = {
|
|
315
|
-
|
|
46
|
+
firstDayOfWeek: valueHelper(weeksList, { required: true, iterate: true }),
|
|
316
47
|
};
|
|
317
48
|
|
|
318
49
|
const testFunc = (props: Record<string, any>): void => {
|
|
319
50
|
const attr = filterUndefined(props) as Props;
|
|
320
51
|
|
|
321
52
|
it(testMessageHelper(attr), () => {
|
|
322
|
-
const { baseElement } = render(
|
|
323
|
-
<DateRangePicker
|
|
324
|
-
startDate={startDate}
|
|
325
|
-
endDate={endDate}
|
|
326
|
-
{...attr}
|
|
327
|
-
/>
|
|
328
|
-
);
|
|
53
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
329
54
|
expect(baseElement).toMatchSnapshot();
|
|
330
55
|
});
|
|
331
56
|
};
|
|
@@ -335,18 +60,15 @@ describe('DateRangePicker component', () => {
|
|
|
335
60
|
|
|
336
61
|
describe('DateRangePicker component', () => {
|
|
337
62
|
const mapper: Record<string, any> = {
|
|
338
|
-
|
|
63
|
+
disabledBefore: valueHelper(dateFormat[1], { required: true }),
|
|
64
|
+
jumpView: valueHelper(booleanValue, { required: true, iterate: true }),
|
|
339
65
|
};
|
|
340
66
|
|
|
341
67
|
const testFunc = (props: Record<string, any>): void => {
|
|
342
68
|
const attr = filterUndefined(props) as Props;
|
|
343
69
|
|
|
344
70
|
it(testMessageHelper(attr), () => {
|
|
345
|
-
const { baseElement } = render(
|
|
346
|
-
<DateRangePicker
|
|
347
|
-
{...attr}
|
|
348
|
-
/>
|
|
349
|
-
);
|
|
71
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
350
72
|
expect(baseElement).toMatchSnapshot();
|
|
351
73
|
});
|
|
352
74
|
};
|
|
@@ -356,18 +78,15 @@ describe('DateRangePicker component', () => {
|
|
|
356
78
|
|
|
357
79
|
describe('DateRangePicker component', () => {
|
|
358
80
|
const mapper: Record<string, any> = {
|
|
359
|
-
|
|
81
|
+
yearNav: valueHelper(numArray, { required: true, iterate: true }),
|
|
82
|
+
disabledAfter: valueHelper(dateFormat[1], { required: true }),
|
|
360
83
|
};
|
|
361
84
|
|
|
362
85
|
const testFunc = (props: Record<string, any>): void => {
|
|
363
86
|
const attr = filterUndefined(props) as Props;
|
|
364
87
|
|
|
365
88
|
it(testMessageHelper(attr), () => {
|
|
366
|
-
const { baseElement } = render(
|
|
367
|
-
<DateRangePicker
|
|
368
|
-
{...attr}
|
|
369
|
-
/>
|
|
370
|
-
);
|
|
89
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
371
90
|
expect(baseElement).toMatchSnapshot();
|
|
372
91
|
});
|
|
373
92
|
};
|
|
@@ -377,20 +96,15 @@ describe('DateRangePicker component', () => {
|
|
|
377
96
|
|
|
378
97
|
describe('DateRangePicker component', () => {
|
|
379
98
|
const mapper: Record<string, any> = {
|
|
380
|
-
|
|
99
|
+
monthNav: valueHelper(numArray, { required: true, iterate: true }),
|
|
100
|
+
monthsInView: valueHelper(numArray, { required: true, iterate: true }),
|
|
381
101
|
};
|
|
382
102
|
|
|
383
103
|
const testFunc = (props: Record<string, any>): void => {
|
|
384
104
|
const attr = filterUndefined(props) as Props;
|
|
385
105
|
|
|
386
106
|
it(testMessageHelper(attr), () => {
|
|
387
|
-
const { baseElement } = render(
|
|
388
|
-
<DateRangePicker
|
|
389
|
-
startDate={startDate}
|
|
390
|
-
endDate={endDate}
|
|
391
|
-
{...attr}
|
|
392
|
-
/>
|
|
393
|
-
);
|
|
107
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
394
108
|
expect(baseElement).toMatchSnapshot();
|
|
395
109
|
});
|
|
396
110
|
};
|
|
@@ -400,20 +114,17 @@ describe('DateRangePicker component', () => {
|
|
|
400
114
|
|
|
401
115
|
describe('DateRangePicker component', () => {
|
|
402
116
|
const mapper: Record<string, any> = {
|
|
403
|
-
|
|
117
|
+
startDate: valueHelper(dateFormat, { required: true, iterate: true }),
|
|
118
|
+
endDate: valueHelper(dateFormat, { required: true, iterate: true }),
|
|
119
|
+
position: valueHelper(position, { required: true, iterate: true }),
|
|
120
|
+
contentAlign: valueHelper(alignPosition, { required: true, iterate: true }),
|
|
404
121
|
};
|
|
405
122
|
|
|
406
123
|
const testFunc = (props: Record<string, any>): void => {
|
|
407
124
|
const attr = filterUndefined(props) as Props;
|
|
408
125
|
|
|
409
126
|
it(testMessageHelper(attr), () => {
|
|
410
|
-
const { baseElement } = render(
|
|
411
|
-
<DateRangePicker
|
|
412
|
-
startDate={startDate}
|
|
413
|
-
endDate={endDate}
|
|
414
|
-
{...attr}
|
|
415
|
-
/>
|
|
416
|
-
);
|
|
127
|
+
const { baseElement } = render(<DateRangePicker {...attr} />);
|
|
417
128
|
expect(baseElement).toMatchSnapshot();
|
|
418
129
|
});
|
|
419
130
|
};
|
|
@@ -423,20 +134,14 @@ describe('DateRangePicker component', () => {
|
|
|
423
134
|
|
|
424
135
|
describe('DateRangePicker component', () => {
|
|
425
136
|
const mapper: Record<string, any> = {
|
|
426
|
-
|
|
137
|
+
singleInput: valueHelper(booleanValue, { required: true, iterate: true }),
|
|
427
138
|
};
|
|
428
139
|
|
|
429
140
|
const testFunc = (props: Record<string, any>): void => {
|
|
430
141
|
const attr = filterUndefined(props) as Props;
|
|
431
142
|
|
|
432
143
|
it(testMessageHelper(attr), () => {
|
|
433
|
-
const { baseElement } = render(
|
|
434
|
-
<DateRangePicker
|
|
435
|
-
startDate={startDate}
|
|
436
|
-
endDate={endDate}
|
|
437
|
-
{...attr}
|
|
438
|
-
/>
|
|
439
|
-
);
|
|
144
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
440
145
|
expect(baseElement).toMatchSnapshot();
|
|
441
146
|
});
|
|
442
147
|
};
|
|
@@ -446,20 +151,15 @@ describe('DateRangePicker component', () => {
|
|
|
446
151
|
|
|
447
152
|
describe('DateRangePicker component', () => {
|
|
448
153
|
const mapper: Record<string, any> = {
|
|
449
|
-
|
|
154
|
+
inputFormat: valueHelper(inputFormat, { required: true, iterate: true }),
|
|
155
|
+
outputFormat: valueHelper(inputFormat, { required: true, iterate: true }),
|
|
450
156
|
};
|
|
451
157
|
|
|
452
158
|
const testFunc = (props: Record<string, any>): void => {
|
|
453
159
|
const attr = filterUndefined(props) as Props;
|
|
454
160
|
|
|
455
161
|
it(testMessageHelper(attr), () => {
|
|
456
|
-
const { baseElement } = render(
|
|
457
|
-
<DateRangePicker
|
|
458
|
-
startDate={startDate}
|
|
459
|
-
endDate={endDate}
|
|
460
|
-
{...attr}
|
|
461
|
-
/>
|
|
462
|
-
);
|
|
162
|
+
const { baseElement } = render(<DateRangePicker startDate={startDate} endDate={endDate} {...attr} />);
|
|
463
163
|
expect(baseElement).toMatchSnapshot();
|
|
464
164
|
});
|
|
465
165
|
};
|
|
@@ -468,27 +168,14 @@ describe('DateRangePicker component', () => {
|
|
|
468
168
|
});
|
|
469
169
|
|
|
470
170
|
describe('DateRangePicker component prop:withInput', () => {
|
|
471
|
-
|
|
472
171
|
it('show InputTrigger if prop:withInput is passed as true', () => {
|
|
473
|
-
const { getByTestId } = render(
|
|
474
|
-
<DateRangePicker
|
|
475
|
-
startDate={startDate}
|
|
476
|
-
endDate={endDate}
|
|
477
|
-
withInput={true}
|
|
478
|
-
/>
|
|
479
|
-
);
|
|
172
|
+
const { getByTestId } = render(<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} />);
|
|
480
173
|
|
|
481
174
|
expect(getByTestId('DesignSystem-DateRangePicker-InputTrigger')).toBeInTheDocument();
|
|
482
175
|
});
|
|
483
176
|
|
|
484
177
|
it('show InputTrigger if prop:withInput is passed as false', () => {
|
|
485
|
-
render(
|
|
486
|
-
<DateRangePicker
|
|
487
|
-
startDate={startDate}
|
|
488
|
-
endDate={endDate}
|
|
489
|
-
withInput={false}
|
|
490
|
-
/>
|
|
491
|
-
);
|
|
178
|
+
render(<DateRangePicker startDate={startDate} endDate={endDate} withInput={false} />);
|
|
492
179
|
|
|
493
180
|
const inputTriggerComponent = screen.queryByText('DesignSystem-DateRangePicker-InputTrigger');
|
|
494
181
|
expect(inputTriggerComponent).not.toBeInTheDocument();
|
|
@@ -498,38 +185,29 @@ describe('DateRangePicker component prop:withInput', () => {
|
|
|
498
185
|
describe('DateRangePicker component prop:singleInput', () => {
|
|
499
186
|
it('show SingleInputTrigger if prop:singleInput is passed as true', () => {
|
|
500
187
|
const { getByTestId } = render(
|
|
501
|
-
<DateRangePicker
|
|
502
|
-
startDate={startDate}
|
|
503
|
-
endDate={endDate}
|
|
504
|
-
singleInput={true}
|
|
505
|
-
withInput={true}
|
|
506
|
-
/>
|
|
188
|
+
<DateRangePicker startDate={startDate} endDate={endDate} singleInput={true} withInput={true} />
|
|
507
189
|
);
|
|
508
190
|
expect(getByTestId('DesignSystem-DateRangePicker-SingleInputTrigger')).toBeInTheDocument();
|
|
509
191
|
});
|
|
510
192
|
|
|
511
193
|
it('show correct label if prop:singleInput is passed as true', () => {
|
|
512
194
|
const { getByTestId } = render(
|
|
513
|
-
<DateRangePicker
|
|
514
|
-
startDate={startDate}
|
|
515
|
-
endDate={endDate}
|
|
516
|
-
singleInput={true}
|
|
517
|
-
withInput={true}
|
|
518
|
-
/>
|
|
195
|
+
<DateRangePicker startDate={startDate} endDate={endDate} singleInput={true} withInput={true} />
|
|
519
196
|
);
|
|
520
197
|
expect(getByTestId('DesignSystem-DateRangePicker-SingleInputTrigger').textContent).toMatch('Date');
|
|
521
198
|
});
|
|
199
|
+
|
|
200
|
+
it('checks prop:singleInput=true with default dates', () => {
|
|
201
|
+
const { getByTestId } = render(<DateRangePicker singleInput={true} withInput={true} />);
|
|
202
|
+
expect(getByTestId('DesignSystem-DateRangePicker-SingleInputTrigger')).toBeInTheDocument();
|
|
203
|
+
expect(screen.getAllByPlaceholderText('mm/dd/yyyy - mm/dd/yyyy')[0]).toBeInTheDocument();
|
|
204
|
+
});
|
|
522
205
|
});
|
|
523
206
|
|
|
524
207
|
describe('DateRangePicker component prop:onRangeChange', () => {
|
|
525
208
|
it('onClear Event handler ', () => {
|
|
526
209
|
const { getAllByTestId } = render(
|
|
527
|
-
<DateRangePicker
|
|
528
|
-
startDate={startDate}
|
|
529
|
-
endDate={endDate}
|
|
530
|
-
withInput={true}
|
|
531
|
-
onRangeChange={FunctionValue}
|
|
532
|
-
/>
|
|
210
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
533
211
|
);
|
|
534
212
|
|
|
535
213
|
const InputTestId = getAllByTestId('DesignSystem-Input--closeIcon');
|
|
@@ -539,12 +217,7 @@ describe('DateRangePicker component prop:onRangeChange', () => {
|
|
|
539
217
|
|
|
540
218
|
it('onChange Event handler ', () => {
|
|
541
219
|
const { getAllByTestId } = render(
|
|
542
|
-
<DateRangePicker
|
|
543
|
-
startDate={startDate}
|
|
544
|
-
endDate={endDate}
|
|
545
|
-
withInput={true}
|
|
546
|
-
onRangeChange={FunctionValue}
|
|
547
|
-
/>
|
|
220
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
548
221
|
);
|
|
549
222
|
|
|
550
223
|
const InputTestId = getAllByTestId('DesignSystem-Input');
|
|
@@ -555,12 +228,7 @@ describe('DateRangePicker component prop:onRangeChange', () => {
|
|
|
555
228
|
|
|
556
229
|
it('onBlur Event handler ', () => {
|
|
557
230
|
const { getAllByTestId } = render(
|
|
558
|
-
<DateRangePicker
|
|
559
|
-
startDate={startDate}
|
|
560
|
-
endDate={endDate}
|
|
561
|
-
withInput={true}
|
|
562
|
-
onRangeChange={FunctionValue}
|
|
563
|
-
/>
|
|
231
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
564
232
|
);
|
|
565
233
|
|
|
566
234
|
const InputTestId = getAllByTestId('DesignSystem-Input');
|
|
@@ -572,14 +240,8 @@ describe('DateRangePicker component prop:onRangeChange', () => {
|
|
|
572
240
|
|
|
573
241
|
describe('DateRangePicker component update state ', () => {
|
|
574
242
|
it('check for updating start date', () => {
|
|
575
|
-
|
|
576
243
|
const { getAllByTestId, rerender } = render(
|
|
577
|
-
<DateRangePicker
|
|
578
|
-
startDate={startDate}
|
|
579
|
-
endDate={endDate}
|
|
580
|
-
withInput={true}
|
|
581
|
-
onRangeChange={FunctionValue}
|
|
582
|
-
/>
|
|
244
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
583
245
|
);
|
|
584
246
|
|
|
585
247
|
const inputComponent = getAllByTestId('DesignSystem-Input');
|
|
@@ -588,25 +250,14 @@ describe('DateRangePicker component update state ', () => {
|
|
|
588
250
|
expect(FunctionValue).toHaveBeenCalled();
|
|
589
251
|
|
|
590
252
|
rerender(
|
|
591
|
-
<DateRangePicker
|
|
592
|
-
startDate={currentDate}
|
|
593
|
-
endDate={endDate}
|
|
594
|
-
withInput={true}
|
|
595
|
-
onRangeChange={FunctionValue}
|
|
596
|
-
/>
|
|
253
|
+
<DateRangePicker startDate={currentDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
597
254
|
);
|
|
598
255
|
expect(FunctionValue).toHaveBeenCalled();
|
|
599
256
|
});
|
|
600
257
|
|
|
601
258
|
it('check for updating end date', () => {
|
|
602
|
-
|
|
603
259
|
const { getAllByTestId, rerender } = render(
|
|
604
|
-
<DateRangePicker
|
|
605
|
-
startDate={startDate}
|
|
606
|
-
endDate={endDate}
|
|
607
|
-
withInput={true}
|
|
608
|
-
onRangeChange={FunctionValue}
|
|
609
|
-
/>
|
|
260
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
610
261
|
);
|
|
611
262
|
|
|
612
263
|
const inputComponent = getAllByTestId('DesignSystem-Input');
|
|
@@ -615,18 +266,12 @@ describe('DateRangePicker component update state ', () => {
|
|
|
615
266
|
expect(FunctionValue).toHaveBeenCalled();
|
|
616
267
|
|
|
617
268
|
rerender(
|
|
618
|
-
<DateRangePicker
|
|
619
|
-
startDate={startDate}
|
|
620
|
-
endDate={currentDate}
|
|
621
|
-
withInput={true}
|
|
622
|
-
onRangeChange={FunctionValue}
|
|
623
|
-
/>
|
|
269
|
+
<DateRangePicker startDate={startDate} endDate={currentDate} withInput={true} onRangeChange={FunctionValue} />
|
|
624
270
|
);
|
|
625
271
|
expect(FunctionValue).toHaveBeenCalled();
|
|
626
272
|
});
|
|
627
273
|
|
|
628
274
|
it('check for updating open state', () => {
|
|
629
|
-
|
|
630
275
|
const { rerender } = render(
|
|
631
276
|
<DateRangePicker
|
|
632
277
|
startDate={startDate}
|
|
@@ -652,7 +297,6 @@ describe('DateRangePicker component update state ', () => {
|
|
|
652
297
|
});
|
|
653
298
|
|
|
654
299
|
it('check for updating yearNav', () => {
|
|
655
|
-
|
|
656
300
|
const { rerender } = render(
|
|
657
301
|
<DateRangePicker
|
|
658
302
|
startDate={startDate}
|
|
@@ -679,7 +323,6 @@ describe('DateRangePicker component update state ', () => {
|
|
|
679
323
|
});
|
|
680
324
|
|
|
681
325
|
it('check for updating monthNav', () => {
|
|
682
|
-
|
|
683
326
|
const { rerender } = render(
|
|
684
327
|
<DateRangePicker
|
|
685
328
|
startDate={startDate}
|
|
@@ -764,7 +407,6 @@ describe('DateRangePicker component Event handlers with prop:singleInput set to
|
|
|
764
407
|
});
|
|
765
408
|
|
|
766
409
|
it('onBlur Event handler ', () => {
|
|
767
|
-
|
|
768
410
|
const { getAllByTestId } = render(
|
|
769
411
|
<DateRangePicker
|
|
770
412
|
startDate={startDate}
|
|
@@ -804,12 +446,7 @@ describe('DateRangePicker component with prop:monthsInView', () => {
|
|
|
804
446
|
|
|
805
447
|
it('check for calender--monthsInView prop default value', () => {
|
|
806
448
|
const { getAllByTestId } = render(
|
|
807
|
-
<DateRangePicker
|
|
808
|
-
startDate={startDate}
|
|
809
|
-
endDate={endDate}
|
|
810
|
-
withInput={true}
|
|
811
|
-
onRangeChange={FunctionValue}
|
|
812
|
-
/>
|
|
449
|
+
<DateRangePicker startDate={startDate} endDate={endDate} withInput={true} onRangeChange={FunctionValue} />
|
|
813
450
|
);
|
|
814
451
|
const InputTestId = getAllByTestId('DesignSystem-Input');
|
|
815
452
|
fireEvent.click(InputTestId[0]);
|
|
@@ -819,7 +456,9 @@ describe('DateRangePicker component with prop:monthsInView', () => {
|
|
|
819
456
|
|
|
820
457
|
describe('DateRangePicker Component with overwrite class', () => {
|
|
821
458
|
it('overwrite DesignSystem-Calendar-Wrapper class', () => {
|
|
822
|
-
const { getByTestId } = render(
|
|
459
|
+
const { getByTestId } = render(
|
|
460
|
+
<DateRangePicker startDate={startDate} endDate={endDate} className="DateRangePickerCustomClass" />
|
|
461
|
+
);
|
|
823
462
|
expect(getByTestId('DesignSystem-Calendar-Wrapper')).toHaveClass('DateRangePickerCustomClass');
|
|
824
463
|
});
|
|
825
464
|
});
|