@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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import ChoiceList, { ChoiceListProps as Props } from '../ChoiceList';
|
|
4
|
+
import { testHelper, filterUndefined, valueHelper, testMessageHelper } from '@/utils/testHelper';
|
|
5
|
+
|
|
6
|
+
const size = ['tiny', 'regular'];
|
|
7
|
+
const alignment = ['horizontal', 'vertical'];
|
|
8
|
+
const choices = [
|
|
9
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
10
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
11
|
+
];
|
|
12
|
+
const BooleanValue = [true, false];
|
|
13
|
+
const FunctionValue = jest.fn();
|
|
14
|
+
|
|
15
|
+
const StringValue = 'ChoiceList';
|
|
16
|
+
|
|
17
|
+
describe('ChoiceList component', () => {
|
|
18
|
+
const mapper: Record<string, any> = {
|
|
19
|
+
title: valueHelper(StringValue, { required: true }),
|
|
20
|
+
choices: valueHelper(choices, { required: true, iterate: true }),
|
|
21
|
+
size: valueHelper(size, { required: true, iterate: true }),
|
|
22
|
+
alignment: valueHelper(alignment, { required: true, iterate: true }),
|
|
23
|
+
allowMultiple: valueHelper(BooleanValue, { required: true, iterate: true }),
|
|
24
|
+
disabled: valueHelper(BooleanValue, { required: true, iterate: true }),
|
|
25
|
+
name: valueHelper(StringValue, { required: true }),
|
|
26
|
+
value: valueHelper(StringValue, { required: true }),
|
|
27
|
+
onChange: valueHelper(FunctionValue, { required: true }),
|
|
28
|
+
};
|
|
29
|
+
const testFunc = (props: Record<string, any>): void => {
|
|
30
|
+
const attr = filterUndefined(props) as Props;
|
|
31
|
+
it(testMessageHelper(attr), () => {
|
|
32
|
+
const { baseElement } = render(
|
|
33
|
+
<ChoiceList
|
|
34
|
+
{...attr}
|
|
35
|
+
choices={[
|
|
36
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
37
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
38
|
+
]}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
expect(baseElement).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
testHelper(mapper, testFunc);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('ChoiceList component', () => {
|
|
48
|
+
it('renders choiceList component', () => {
|
|
49
|
+
const { getByTestId } = render(
|
|
50
|
+
<ChoiceList
|
|
51
|
+
allowMultiple={true}
|
|
52
|
+
alignment={'horizontal'}
|
|
53
|
+
choices={[
|
|
54
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
55
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
expect(getByTestId('DesignSystem-ChoiceList-Wrapper')).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('renders choiceList component when allowMultiple is true and alignment is horizontal', () => {
|
|
63
|
+
const { getAllByTestId, container } = render(
|
|
64
|
+
<ChoiceList
|
|
65
|
+
allowMultiple={true}
|
|
66
|
+
alignment={'horizontal'}
|
|
67
|
+
choices={[
|
|
68
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
69
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
70
|
+
]}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
expect(getAllByTestId('DesignSystem-Checkbox')[0]).toBeInTheDocument();
|
|
74
|
+
expect(container.querySelectorAll('.ChoiceList--alignHorizontal')[0]).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('renders choiceList component when allowMultiple is false and alignment is horizontal', () => {
|
|
78
|
+
const { getAllByTestId, container } = render(
|
|
79
|
+
<ChoiceList
|
|
80
|
+
allowMultiple={false}
|
|
81
|
+
alignment={'horizontal'}
|
|
82
|
+
choices={[
|
|
83
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
84
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
85
|
+
]}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
expect(getAllByTestId('DesignSystem-Radio')[0]).toBeInTheDocument();
|
|
89
|
+
expect(container.querySelectorAll('.ChoiceList--alignHorizontal')[0]).toBeInTheDocument();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('renders choiceList component when allowMultiple is true and alignment is vertical', () => {
|
|
93
|
+
const { getAllByTestId, container } = render(
|
|
94
|
+
<ChoiceList
|
|
95
|
+
allowMultiple={true}
|
|
96
|
+
alignment={'vertical'}
|
|
97
|
+
choices={[
|
|
98
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
99
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
100
|
+
]}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
expect(getAllByTestId('DesignSystem-Checkbox')[0]).toBeInTheDocument();
|
|
104
|
+
expect(container.querySelectorAll('.ChoiceList--alignVertical')[0]).toBeInTheDocument();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('renders choiceList component when allowMultiple is false and alignment is vertical', () => {
|
|
108
|
+
const { getAllByTestId, container } = render(
|
|
109
|
+
<ChoiceList
|
|
110
|
+
allowMultiple={false}
|
|
111
|
+
alignment={'vertical'}
|
|
112
|
+
choices={[
|
|
113
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
114
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
115
|
+
]}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
expect(getAllByTestId('DesignSystem-Radio')[0]).toBeInTheDocument();
|
|
119
|
+
expect(container.querySelectorAll('.ChoiceList--alignVertical')[0]).toBeInTheDocument();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('renders choiceList component when allowMultiple is true and alignment is vertical', () => {
|
|
123
|
+
const { getAllByTestId } = render(
|
|
124
|
+
<ChoiceList
|
|
125
|
+
allowMultiple={true}
|
|
126
|
+
alignment={'vertical'}
|
|
127
|
+
choices={[
|
|
128
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
129
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
130
|
+
]}
|
|
131
|
+
onChange={FunctionValue}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
const checkbox = getAllByTestId('DesignSystem-Checkbox-InputBox')[0];
|
|
135
|
+
fireEvent.click(checkbox, { target: { checked: true } });
|
|
136
|
+
expect(FunctionValue).toHaveBeenCalled();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('renders choiceList component when allowMultiple is false and alignment is vertical', () => {
|
|
140
|
+
const { getAllByTestId } = render(
|
|
141
|
+
<ChoiceList
|
|
142
|
+
allowMultiple={false}
|
|
143
|
+
alignment={'vertical'}
|
|
144
|
+
choices={[
|
|
145
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
146
|
+
{ label: 'radio', name: 'choiceList', value: 'radio' },
|
|
147
|
+
]}
|
|
148
|
+
onChange={FunctionValue}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
const radio = getAllByTestId('DesignSystem-Radio-Input')[0];
|
|
152
|
+
fireEvent.click(radio);
|
|
153
|
+
expect(FunctionValue).toHaveBeenCalled();
|
|
154
|
+
});
|
|
155
|
+
});
|