@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
|
@@ -7,33 +7,29 @@ import DropzoneError from '../DropzoneError';
|
|
|
7
7
|
import { fromEvent } from '../FileSelectorUtils';
|
|
8
8
|
|
|
9
9
|
const formatLabel = 'Accepted formats: PDF, JPG';
|
|
10
|
-
const sizeLabel = 'Maximum size: 30 MB'
|
|
10
|
+
const sizeLabel = 'Maximum size: 30 MB';
|
|
11
11
|
const BooleanValue = [true, false];
|
|
12
12
|
const FunctionValue = jest.fn();
|
|
13
13
|
|
|
14
14
|
const fileData = {
|
|
15
15
|
dataTransfer: {
|
|
16
16
|
files: [new File(['(⌐□_□)'], 'file1.png')],
|
|
17
|
-
types: ['Files']
|
|
17
|
+
types: ['Files'],
|
|
18
18
|
},
|
|
19
|
-
size: 1024
|
|
20
|
-
}
|
|
19
|
+
size: 1024,
|
|
20
|
+
};
|
|
21
21
|
|
|
22
22
|
const multipleFileData = {
|
|
23
23
|
dataTransfer: {
|
|
24
24
|
files: [new File(['(⌐□_□)'], 'file1.png'), new File(['(⌐□_□)'], 'file2.jpeg')],
|
|
25
|
-
types: ['Files']
|
|
25
|
+
types: ['Files'],
|
|
26
26
|
},
|
|
27
|
-
size: 2048
|
|
28
|
-
}
|
|
27
|
+
size: 2048,
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
const minSize = 50;
|
|
31
31
|
const maxSize = 300;
|
|
32
|
-
const types: Type[] = [
|
|
33
|
-
'standard',
|
|
34
|
-
'compressed',
|
|
35
|
-
'tight'
|
|
36
|
-
];
|
|
32
|
+
const types: Type[] = ['standard', 'compressed', 'tight'];
|
|
37
33
|
|
|
38
34
|
describe('Dropzone component snapshot', () => {
|
|
39
35
|
const mapper: Record<string, any> = {
|
|
@@ -47,11 +43,7 @@ describe('Dropzone component snapshot', () => {
|
|
|
47
43
|
const attr = filterUndefined(props) as Props;
|
|
48
44
|
|
|
49
45
|
it(testMessageHelper(attr), () => {
|
|
50
|
-
const { asFragment } = render(
|
|
51
|
-
<Dropzone
|
|
52
|
-
{...attr}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
46
|
+
const { asFragment } = render(<Dropzone {...attr} />);
|
|
55
47
|
expect(asFragment()).toMatchSnapshot();
|
|
56
48
|
});
|
|
57
49
|
};
|
|
@@ -72,11 +64,7 @@ describe('Dropzone component snapshot', () => {
|
|
|
72
64
|
const attr = filterUndefined(props) as Props;
|
|
73
65
|
|
|
74
66
|
it(testMessageHelper(attr), () => {
|
|
75
|
-
const { asFragment } = render(
|
|
76
|
-
<Dropzone
|
|
77
|
-
{...attr}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
67
|
+
const { asFragment } = render(<Dropzone {...attr} />);
|
|
80
68
|
expect(asFragment()).toMatchSnapshot();
|
|
81
69
|
});
|
|
82
70
|
};
|
|
@@ -86,24 +74,24 @@ describe('Dropzone component snapshot', () => {
|
|
|
86
74
|
|
|
87
75
|
describe('Dropzone component', () => {
|
|
88
76
|
it('renders prop:formatLabel', () => {
|
|
89
|
-
const { getAllByTestId } = render(<Dropzone formatLabel={formatLabel} />)
|
|
90
|
-
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(formatLabel)
|
|
77
|
+
const { getAllByTestId } = render(<Dropzone formatLabel={formatLabel} />);
|
|
78
|
+
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(formatLabel);
|
|
91
79
|
});
|
|
92
80
|
|
|
93
81
|
it('renders prop:sizeLabel', () => {
|
|
94
|
-
const { getAllByTestId } = render(<Dropzone sizeLabel={sizeLabel} />)
|
|
95
|
-
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(sizeLabel)
|
|
82
|
+
const { getAllByTestId } = render(<Dropzone sizeLabel={sizeLabel} />);
|
|
83
|
+
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(sizeLabel);
|
|
96
84
|
});
|
|
97
85
|
|
|
98
86
|
it('renders prop:sizeLabel & prop:formatLabel', () => {
|
|
99
|
-
const { getAllByTestId } = render(<Dropzone sizeLabel={sizeLabel} formatLabel={formatLabel} />)
|
|
100
|
-
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(formatLabel)
|
|
101
|
-
expect(getAllByTestId('DesignSystem-Text')[3]).toHaveTextContent(sizeLabel)
|
|
87
|
+
const { getAllByTestId } = render(<Dropzone sizeLabel={sizeLabel} formatLabel={formatLabel} />);
|
|
88
|
+
expect(getAllByTestId('DesignSystem-Text')[2]).toHaveTextContent(formatLabel);
|
|
89
|
+
expect(getAllByTestId('DesignSystem-Text')[3]).toHaveTextContent(sizeLabel);
|
|
102
90
|
});
|
|
103
91
|
|
|
104
92
|
it('check for prop:disabled', () => {
|
|
105
|
-
const { getByTestId } = render(<Dropzone disabled={true} />)
|
|
106
|
-
expect(getByTestId('DesignSystem-Dropzone')).toHaveClass('Dropzone--disabled')
|
|
93
|
+
const { getByTestId } = render(<Dropzone disabled={true} />);
|
|
94
|
+
expect(getByTestId('DesignSystem-Dropzone')).toHaveClass('Dropzone--disabled');
|
|
107
95
|
});
|
|
108
96
|
});
|
|
109
97
|
|
|
@@ -121,15 +109,11 @@ describe('Dropzone component prop:sampleFileLink', () => {
|
|
|
121
109
|
it('check for sampleFileLink element', () => {
|
|
122
110
|
const { getByTestId } = render(
|
|
123
111
|
<Dropzone
|
|
124
|
-
sampleFileLink={
|
|
125
|
-
<Link
|
|
126
|
-
href=""
|
|
127
|
-
download="Test.pdf"
|
|
128
|
-
target="_blank"
|
|
129
|
-
>
|
|
112
|
+
sampleFileLink={
|
|
113
|
+
<Link href="" download="Test.pdf" target="_blank">
|
|
130
114
|
Download sample file
|
|
131
115
|
</Link>
|
|
132
|
-
|
|
116
|
+
}
|
|
133
117
|
/>
|
|
134
118
|
);
|
|
135
119
|
expect(getByTestId('DesignSystem-Link')).toBeInTheDocument();
|
|
@@ -137,80 +121,46 @@ describe('Dropzone component prop:sampleFileLink', () => {
|
|
|
137
121
|
});
|
|
138
122
|
|
|
139
123
|
describe('Dropzone component event handlers', () => {
|
|
140
|
-
|
|
141
124
|
it('checks for onDragLeave event', () => {
|
|
142
|
-
const { getByTestId } = render(
|
|
143
|
-
<Dropzone
|
|
144
|
-
onDragLeave={FunctionValue}
|
|
145
|
-
accept="image/png"
|
|
146
|
-
/>
|
|
147
|
-
);
|
|
125
|
+
const { getByTestId } = render(<Dropzone onDragLeave={FunctionValue} accept="image/png" />);
|
|
148
126
|
fireEvent.dragLeave(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
149
127
|
expect(FunctionValue).toHaveBeenCalled();
|
|
150
128
|
});
|
|
151
129
|
|
|
152
130
|
it('checks for onDragEnter event', () => {
|
|
153
131
|
const { getByTestId } = render(
|
|
154
|
-
<Dropzone
|
|
155
|
-
onDragLeave={FunctionValue}
|
|
156
|
-
accept="image/png"
|
|
157
|
-
maxSize={maxSize}
|
|
158
|
-
minSize={minSize}
|
|
159
|
-
multiple={false}
|
|
160
|
-
/>
|
|
132
|
+
<Dropzone onDragLeave={FunctionValue} accept="image/png" maxSize={maxSize} minSize={minSize} multiple={false} />
|
|
161
133
|
);
|
|
162
134
|
fireEvent.dragEnter(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
163
135
|
expect(FunctionValue).toHaveBeenCalled();
|
|
164
136
|
});
|
|
165
137
|
|
|
166
138
|
it('checks for onDragOver event', () => {
|
|
167
|
-
const { getByTestId } = render(
|
|
168
|
-
<Dropzone
|
|
169
|
-
onDragOver={FunctionValue}
|
|
170
|
-
accept="image/png"
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
139
|
+
const { getByTestId } = render(<Dropzone onDragOver={FunctionValue} accept="image/png" />);
|
|
173
140
|
fireEvent.dragOver(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
174
141
|
expect(FunctionValue).toHaveBeenCalled();
|
|
175
142
|
});
|
|
176
143
|
|
|
177
144
|
it('checks for onDrop event', () => {
|
|
178
|
-
const { getByTestId } = render(
|
|
179
|
-
<Dropzone
|
|
180
|
-
onDrop={FunctionValue}
|
|
181
|
-
accept="image/png"
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
145
|
+
const { getByTestId } = render(<Dropzone onDrop={FunctionValue} accept="image/png" />);
|
|
184
146
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
185
147
|
expect(FunctionValue).toHaveBeenCalled();
|
|
186
148
|
});
|
|
187
149
|
|
|
188
150
|
it('checks for onDropAccepted event', () => {
|
|
189
|
-
const { getByTestId } = render(
|
|
190
|
-
<Dropzone
|
|
191
|
-
onDropAccepted={FunctionValue}
|
|
192
|
-
accept="image/png"
|
|
193
|
-
/>
|
|
194
|
-
);
|
|
151
|
+
const { getByTestId } = render(<Dropzone onDropAccepted={FunctionValue} accept="image/png" />);
|
|
195
152
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
196
153
|
expect(FunctionValue).toHaveBeenCalled();
|
|
197
154
|
});
|
|
198
155
|
|
|
199
156
|
it('checks for onDropRejected event', () => {
|
|
200
|
-
const { getByTestId } = render(
|
|
201
|
-
<Dropzone
|
|
202
|
-
onDropRejected={FunctionValue}
|
|
203
|
-
accept="image/jpeg"
|
|
204
|
-
/>);
|
|
157
|
+
const { getByTestId } = render(<Dropzone onDropRejected={FunctionValue} accept="image/jpeg" />);
|
|
205
158
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
206
159
|
expect(FunctionValue).toHaveBeenCalled();
|
|
207
160
|
});
|
|
208
161
|
|
|
209
162
|
it('check for browse file onOpenDialog option', () => {
|
|
210
|
-
const { getAllByTestId } = render(
|
|
211
|
-
<Dropzone
|
|
212
|
-
onDropAccepted={FunctionValue}
|
|
213
|
-
/>);
|
|
163
|
+
const { getAllByTestId } = render(<Dropzone onDropAccepted={FunctionValue} />);
|
|
214
164
|
|
|
215
165
|
fireEvent.click(getAllByTestId('DesignSystem-Text')[1]);
|
|
216
166
|
fireEvent.focus(window);
|
|
@@ -219,40 +169,28 @@ describe('Dropzone component event handlers', () => {
|
|
|
219
169
|
|
|
220
170
|
it('check for browse file onCloseDialog option', () => {
|
|
221
171
|
const { getAllByTestId, getByTestId } = render(
|
|
222
|
-
<Dropzone
|
|
223
|
-
|
|
224
|
-
onDragEnter={FunctionValue}
|
|
225
|
-
/>);
|
|
172
|
+
<Dropzone onFileDialogCancel={FunctionValue} onDragEnter={FunctionValue} />
|
|
173
|
+
);
|
|
226
174
|
|
|
227
175
|
fireEvent.dragEnter(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
228
176
|
fireEvent.click(getAllByTestId('DesignSystem-Text')[1]);
|
|
229
177
|
fireEvent.focus(window);
|
|
230
|
-
fireEvent.keyDown(window, { key: 'Escape', code: 'Escape' })
|
|
178
|
+
fireEvent.keyDown(window, { key: 'Escape', code: 'Escape' });
|
|
231
179
|
|
|
232
180
|
expect(FunctionValue).toHaveBeenCalled();
|
|
233
181
|
});
|
|
234
182
|
});
|
|
235
183
|
|
|
236
184
|
describe('dropzone component prop:multiple', () => {
|
|
237
|
-
|
|
238
185
|
it('renders component when multiple=false', () => {
|
|
239
|
-
const { getByTestId } = render(
|
|
240
|
-
<Dropzone
|
|
241
|
-
onDropRejected={FunctionValue}
|
|
242
|
-
multiple={false}
|
|
243
|
-
/>
|
|
244
|
-
);
|
|
186
|
+
const { getByTestId } = render(<Dropzone onDropRejected={FunctionValue} multiple={false} />);
|
|
245
187
|
|
|
246
188
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), multipleFileData);
|
|
247
189
|
expect(FunctionValue).toHaveBeenCalled();
|
|
248
190
|
});
|
|
249
191
|
|
|
250
192
|
it('renders component when multiple=true', () => {
|
|
251
|
-
const { getByTestId } = render(
|
|
252
|
-
<Dropzone
|
|
253
|
-
onDrop={FunctionValue}
|
|
254
|
-
multiple={true}
|
|
255
|
-
/>);
|
|
193
|
+
const { getByTestId } = render(<Dropzone onDrop={FunctionValue} multiple={true} />);
|
|
256
194
|
|
|
257
195
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), multipleFileData);
|
|
258
196
|
|
|
@@ -262,12 +200,7 @@ describe('dropzone component prop:multiple', () => {
|
|
|
262
200
|
|
|
263
201
|
describe('dropzone component prop:accept', () => {
|
|
264
202
|
it('checks when prop:accept is passed as an array', () => {
|
|
265
|
-
const { getByTestId } = render(
|
|
266
|
-
<Dropzone
|
|
267
|
-
onDrop={FunctionValue}
|
|
268
|
-
multiple={true}
|
|
269
|
-
accept={['image/png']}
|
|
270
|
-
/>);
|
|
203
|
+
const { getByTestId } = render(<Dropzone onDrop={FunctionValue} multiple={true} accept={['image/png']} />);
|
|
271
204
|
|
|
272
205
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), multipleFileData);
|
|
273
206
|
|
|
@@ -284,7 +217,8 @@ describe('dropzone component prop:Size', () => {
|
|
|
284
217
|
minSize={minSize}
|
|
285
218
|
multiple={false}
|
|
286
219
|
accept="image/jpeg"
|
|
287
|
-
/>
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
288
222
|
|
|
289
223
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
290
224
|
expect(FunctionValue).toHaveBeenCalled();
|
|
@@ -298,7 +232,8 @@ describe('dropzone component prop:Size', () => {
|
|
|
298
232
|
minSize={minSize + 2000}
|
|
299
233
|
multiple={false}
|
|
300
234
|
accept="image/jpeg"
|
|
301
|
-
/>
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
302
237
|
|
|
303
238
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
304
239
|
expect(FunctionValue).toHaveBeenCalled();
|
|
@@ -307,13 +242,12 @@ describe('dropzone component prop:Size', () => {
|
|
|
307
242
|
|
|
308
243
|
describe('DropzoneError Component', () => {
|
|
309
244
|
it('check for error message', () => {
|
|
310
|
-
const { getByTestId } = render(<DropzoneError error="File Type Not Supported" type="standard" />)
|
|
311
|
-
expect(getByTestId('DesignSystem-Text')).toHaveTextContent('File Type Not Supported')
|
|
245
|
+
const { getByTestId } = render(<DropzoneError error="File Type Not Supported" type="standard" />);
|
|
246
|
+
expect(getByTestId('DesignSystem-Text')).toHaveTextContent('File Type Not Supported');
|
|
312
247
|
});
|
|
313
248
|
});
|
|
314
249
|
|
|
315
250
|
describe('dropzone component prop:getFilesFromEvent', () => {
|
|
316
|
-
|
|
317
251
|
it('checks for onDragEnter event', () => {
|
|
318
252
|
const { getByTestId } = render(
|
|
319
253
|
<Dropzone
|
|
@@ -323,7 +257,8 @@ describe('dropzone component prop:getFilesFromEvent', () => {
|
|
|
323
257
|
getFilesFromEvent={fromEvent}
|
|
324
258
|
minSize={minSize}
|
|
325
259
|
maxSize={maxSize}
|
|
326
|
-
/>
|
|
260
|
+
/>
|
|
261
|
+
);
|
|
327
262
|
|
|
328
263
|
fireEvent.dragEnter(getByTestId('DesignSystem-Dropzone'), {});
|
|
329
264
|
expect(FunctionValue).toHaveBeenCalled();
|
|
@@ -337,7 +272,8 @@ describe('dropzone component prop:getFilesFromEvent', () => {
|
|
|
337
272
|
accept={['image/jpeg']}
|
|
338
273
|
minSize={minSize}
|
|
339
274
|
maxSize={maxSize}
|
|
340
|
-
/>
|
|
275
|
+
/>
|
|
276
|
+
);
|
|
341
277
|
|
|
342
278
|
fireEvent.dragEnter(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
343
279
|
expect(FunctionValue).toHaveBeenCalled();
|
|
@@ -353,9 +289,9 @@ describe('dropzone component prop:getFilesFromEvent', () => {
|
|
|
353
289
|
minSize={minSize}
|
|
354
290
|
maxSize={maxSize}
|
|
355
291
|
/>
|
|
356
|
-
)
|
|
292
|
+
);
|
|
357
293
|
fireEvent.drop(getByTestId('DesignSystem-Dropzone'), fileData);
|
|
358
294
|
expect(getByTestId('DesignSystem-Dropzone')).toBeInTheDocument();
|
|
359
295
|
expect(FunctionValue).toHaveBeenCalled();
|
|
360
|
-
})
|
|
296
|
+
});
|
|
361
297
|
});
|
|
@@ -4,22 +4,22 @@ import { reducer, isIeOrEdge, isKindFile, isPropagationStopped } from '../utils'
|
|
|
4
4
|
const fileData = {
|
|
5
5
|
dataTransfer: {
|
|
6
6
|
files: [new File(['(⌐□_□)'], 'file1.png')],
|
|
7
|
-
types: ['Files']
|
|
7
|
+
types: ['Files'],
|
|
8
8
|
},
|
|
9
|
-
size: 1024
|
|
10
|
-
}
|
|
9
|
+
size: 1024,
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
const options = {
|
|
13
13
|
files: [fileData],
|
|
14
14
|
accept: 'images/jpeg',
|
|
15
15
|
minSize: 100,
|
|
16
16
|
maxSize: 200,
|
|
17
|
-
multiple: false
|
|
18
|
-
}
|
|
17
|
+
multiple: false,
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
const event = {
|
|
21
|
-
cancelBubble: false
|
|
22
|
-
}
|
|
21
|
+
cancelBubble: false,
|
|
22
|
+
};
|
|
23
23
|
|
|
24
24
|
const Actions = ['focus', 'blur', 'closeDialog', 'default'];
|
|
25
25
|
|
|
@@ -28,24 +28,24 @@ test('dropzone component: check for fileError function', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('dropzone component: check for fileError function', () => {
|
|
31
|
-
options.files = [fileData, fileData]
|
|
31
|
+
options.files = [fileData, fileData];
|
|
32
32
|
expect(getFileError(options));
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
describe('dropzone component: check for reducers', () => {
|
|
36
36
|
Actions.forEach((actionItem) => {
|
|
37
|
-
const state = 'state'
|
|
38
|
-
const action = { type: actionItem }
|
|
39
|
-
expect(reducer(state, action))
|
|
37
|
+
const state = 'state';
|
|
38
|
+
const action = { type: actionItem };
|
|
39
|
+
expect(reducer(state, action));
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
test('dropzone component: check for browser compatibility', () => {
|
|
44
|
-
expect(isIeOrEdge(window.navigator.userAgent))
|
|
44
|
+
expect(isIeOrEdge(window.navigator.userAgent));
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
test('dropzone component: checks isKindFile function', () => {
|
|
48
|
-
expect(isKindFile({ options }))
|
|
48
|
+
expect(isKindFile({ options }));
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('dropzone component: checks for isPropagationStopped function', () => {
|
|
@@ -165,7 +165,9 @@ export const EditableChipInput = (props: EditableChipInputProps) => {
|
|
|
165
165
|
icon="clear"
|
|
166
166
|
className="mr-3"
|
|
167
167
|
size="tiny"
|
|
168
|
-
onClick={() => {
|
|
168
|
+
onClick={() => {
|
|
169
|
+
setDefaultComponent(value);
|
|
170
|
+
}}
|
|
169
171
|
/>
|
|
170
172
|
<Button
|
|
171
173
|
data-test="DesignSystem-EditableChipInput--SaveButton"
|
|
@@ -147,8 +147,8 @@ export const EditableInput = (props: EditableInputProps) => {
|
|
|
147
147
|
</Text>
|
|
148
148
|
</Popover>
|
|
149
149
|
) : (
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
inputComponent
|
|
151
|
+
);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
return (
|
|
@@ -169,7 +169,9 @@ export const EditableInput = (props: EditableInputProps) => {
|
|
|
169
169
|
icon="clear"
|
|
170
170
|
className="mr-3"
|
|
171
171
|
size="tiny"
|
|
172
|
-
onClick={() => {
|
|
172
|
+
onClick={() => {
|
|
173
|
+
setDefaultComponent(value);
|
|
174
|
+
}}
|
|
173
175
|
data-test="DesignSystem-EditableInput--Discard"
|
|
174
176
|
/>
|
|
175
177
|
<Button
|
|
@@ -157,9 +157,7 @@ describe('EditableInput component with action buttons and props: value and input
|
|
|
157
157
|
it('save changes and editable input is uncontrolled', () => {
|
|
158
158
|
const updatedValue = 'Design System';
|
|
159
159
|
|
|
160
|
-
const { getByTestId, queryByTestId } = render(
|
|
161
|
-
<EditableInput placeholder={StringValue} onChange={onChange} />
|
|
162
|
-
);
|
|
160
|
+
const { getByTestId, queryByTestId } = render(<EditableInput placeholder={StringValue} onChange={onChange} />);
|
|
163
161
|
|
|
164
162
|
const editableWrapper = getByTestId(editableWrapperTestId);
|
|
165
163
|
fireEvent.click(editableWrapper);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { EmptyState, Button } from '@/index';
|
|
4
|
-
import { EmptyStateProps as Props, HeadingProps
|
|
4
|
+
import { EmptyStateProps as Props, HeadingProps } from '@/index.type';
|
|
5
5
|
import { testHelper, filterUndefined, valueHelper, testMessageHelper } from '@/utils/testHelper';
|
|
6
6
|
|
|
7
7
|
const sizes: Props['size'][] = ['large', 'small'];
|
|
@@ -15,10 +15,6 @@ const HeadingSize: Record<Props['size'], HeadingProps['size']> = {
|
|
|
15
15
|
small: 'm',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const textSize: Record<Props['size'], TextProps['size']> = {
|
|
19
|
-
large: 'large',
|
|
20
|
-
small: 'regular',
|
|
21
|
-
};
|
|
22
18
|
const title = 'Manage your outreach campaigns';
|
|
23
19
|
const description = 'Campaigns let you reach out to patients with text messages, emails and voice calls';
|
|
24
20
|
const imageSrc = 'noContent';
|
|
@@ -99,8 +95,8 @@ describe('EmptyState with prop: size', () => {
|
|
|
99
95
|
expect(getByTestId('DesignSystem-EmptyState--Text')).toHaveClass(
|
|
100
96
|
`EmptyState-description EmptyState-description--${size}`
|
|
101
97
|
);
|
|
102
|
-
expect(getByTestId('DesignSystem-EmptyState--Heading')).
|
|
103
|
-
expect(getByTestId('DesignSystem-EmptyState--Text')).
|
|
98
|
+
expect(getByTestId('DesignSystem-EmptyState--Heading')).toHaveClass(`Heading--${HeadingSize[size]}`);
|
|
99
|
+
expect(getByTestId('DesignSystem-EmptyState--Text')).toHaveClass(`EmptyState-description--${size}`);
|
|
104
100
|
expect(getByTestId('DesignSystem-EmptyState--Img')).toHaveAttribute('height', imageHeight[size]);
|
|
105
101
|
});
|
|
106
102
|
});
|
|
@@ -54,7 +54,12 @@ export const FileUploaderItem = (props: FileUploaderItemProps) => {
|
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<div
|
|
57
|
+
<div
|
|
58
|
+
{...baseProps}
|
|
59
|
+
data-test="DesignSystem-FileUploader--Item"
|
|
60
|
+
className={FileItemClass}
|
|
61
|
+
onClick={() => onClick && onClick(file, id)}
|
|
62
|
+
>
|
|
58
63
|
<div className="FileUploaderItem-file">
|
|
59
64
|
<Text className="FileUploaderItem-text" appearance={status === 'completed' ? 'default' : 'subtle'}>
|
|
60
65
|
{name}
|
|
@@ -67,7 +72,13 @@ export const FileUploaderItem = (props: FileUploaderItemProps) => {
|
|
|
67
72
|
progress={progress}
|
|
68
73
|
onRetry={() => onRetry && onRetry(file, id)}
|
|
69
74
|
/>
|
|
70
|
-
<Button
|
|
75
|
+
<Button
|
|
76
|
+
data-test="DesignSystem-FileUploader--CancelButton"
|
|
77
|
+
appearance="transparent"
|
|
78
|
+
size="regular"
|
|
79
|
+
onClick={() => onDelete && onDelete(file, id)}
|
|
80
|
+
icon="close"
|
|
81
|
+
/>
|
|
71
82
|
</div>
|
|
72
83
|
</div>
|
|
73
84
|
{status === 'error' && <Caption error={true}>{errorMessage}</Caption>}
|