@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
|
@@ -65,12 +65,9 @@ export const Radio = React.forwardRef<HTMLInputElement, RadioProps>((props, forw
|
|
|
65
65
|
|
|
66
66
|
const ref = React.useRef<HTMLInputElement>(null);
|
|
67
67
|
|
|
68
|
-
React.useImperativeHandle(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return ref.current as HTMLInputElement;
|
|
72
|
-
}
|
|
73
|
-
);
|
|
68
|
+
React.useImperativeHandle(forwardedRef, (): HTMLInputElement => {
|
|
69
|
+
return ref.current as HTMLInputElement;
|
|
70
|
+
});
|
|
74
71
|
|
|
75
72
|
const RadioClass = classNames(
|
|
76
73
|
{
|
|
@@ -123,10 +120,10 @@ export const Radio = React.forwardRef<HTMLInputElement, RadioProps>((props, forw
|
|
|
123
120
|
</label>
|
|
124
121
|
)}
|
|
125
122
|
{helpText && (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
<Text data-test="DesignSystem-Radio-HelpText" size="small" appearance={disabled ? 'disabled' : 'subtle'}>
|
|
124
|
+
{helpText.trim()}
|
|
125
|
+
</Text>
|
|
126
|
+
)}
|
|
130
127
|
</div>
|
|
131
128
|
</div>
|
|
132
129
|
);
|
|
@@ -57,27 +57,29 @@ describe('Radio component', () => {
|
|
|
57
57
|
|
|
58
58
|
describe('Radio component', () => {
|
|
59
59
|
it('renders children', () => {
|
|
60
|
-
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue}/>);
|
|
60
|
+
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue} />);
|
|
61
61
|
expect(getByTestId('DesignSystem-Radio')).toBeInTheDocument();
|
|
62
62
|
expect(getByTestId('DesignSystem-Radio-OuterWrapper')).toBeInTheDocument();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('renders children : input', () => {
|
|
66
|
-
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue}/>);
|
|
66
|
+
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue} />);
|
|
67
67
|
expect(getByTestId('DesignSystem-Radio')).toBeInTheDocument();
|
|
68
68
|
expect(getByTestId('DesignSystem-Radio-OuterWrapper')).toBeInTheDocument();
|
|
69
69
|
expect(getByTestId('DesignSystem-Radio-Input')).toBeInTheDocument();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('renders children with label prop', () => {
|
|
73
|
-
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue}/>);
|
|
73
|
+
const { getByTestId } = render(<Radio label={label} name={StringValue} value={StringValue} />);
|
|
74
74
|
expect(getByTestId('DesignSystem-Radio-Input')).toBeInTheDocument();
|
|
75
75
|
expect(getByTestId('DesignSystem-Radio-Label')).toBeInTheDocument();
|
|
76
|
-
expect(getByTestId('DesignSystem-Radio-Label').textContent).toMatch(label)
|
|
76
|
+
expect(getByTestId('DesignSystem-Radio-Label').textContent).toMatch(label);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
it('renders children with helpText prop', () => {
|
|
80
|
-
const { getByTestId } = render(
|
|
80
|
+
const { getByTestId } = render(
|
|
81
|
+
<Radio label={label} name={StringValue} value={StringValue} helpText={StringValue} />
|
|
82
|
+
);
|
|
81
83
|
expect(getByTestId('DesignSystem-Radio-Input')).toBeInTheDocument();
|
|
82
84
|
expect(getByTestId('DesignSystem-Radio-Label')).toBeInTheDocument();
|
|
83
85
|
expect(getByTestId('DesignSystem-Radio-HelpText')).toBeInTheDocument();
|
|
@@ -85,14 +87,18 @@ describe('Radio component', () => {
|
|
|
85
87
|
});
|
|
86
88
|
|
|
87
89
|
it('calls onchange handler', () => {
|
|
88
|
-
const { getByTestId } = render(
|
|
90
|
+
const { getByTestId } = render(
|
|
91
|
+
<Radio onChange={FunctionValue} label={label} name={StringValue} value={StringValue} helpText={StringValue} />
|
|
92
|
+
);
|
|
89
93
|
const input = getByTestId('DesignSystem-Radio-Input');
|
|
90
94
|
fireEvent.click(input);
|
|
91
95
|
expect(FunctionValue).toHaveBeenCalled();
|
|
92
96
|
});
|
|
93
97
|
|
|
94
98
|
it('calls onchange handler when box is checked ', () => {
|
|
95
|
-
const { getByTestId } = render(
|
|
99
|
+
const { getByTestId } = render(
|
|
100
|
+
<Radio onChange={FunctionValue} name={label} value={StringValue} label={StringValue} helpText={StringValue} />
|
|
101
|
+
);
|
|
96
102
|
const input = getByTestId('DesignSystem-Radio-Input');
|
|
97
103
|
expect(input).not.toBeChecked();
|
|
98
104
|
fireEvent.change(input, { target: { checked: true } });
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Heading, Paragraph, Card, Table, Text } from '@/index';
|
|
3
|
+
import utilitiesSchema from '../Schema';
|
|
4
|
+
|
|
5
|
+
export const border = () => {
|
|
6
|
+
const data = [
|
|
7
|
+
{
|
|
8
|
+
className: 'border',
|
|
9
|
+
properties: 'border: var(--border) ;',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
className: 'border-top',
|
|
13
|
+
properties: ' border-top: var(--border) ;',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
className: 'border-bottom',
|
|
17
|
+
properties: 'border-bottom: var(--border) ;',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
className: 'border-right',
|
|
21
|
+
properties: 'border-right: var(--border) ;',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
className: 'border-left',
|
|
25
|
+
properties: 'border-left: var(--border) ;',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
className: 'border-0',
|
|
29
|
+
properties: 'border: 0 ;',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
className: 'border-top-0',
|
|
33
|
+
properties: ' border-top: 0 ;',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
className: 'border-bottom-0',
|
|
37
|
+
properties: 'border-bottom: 0 ;',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
className: 'border-right-0',
|
|
41
|
+
properties: 'border-right: 0 ;',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
return (
|
|
45
|
+
<div>
|
|
46
|
+
<Heading size="xxl">Border</Heading>
|
|
47
|
+
<br />
|
|
48
|
+
|
|
49
|
+
<Text weight="strong">
|
|
50
|
+
Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.
|
|
51
|
+
</Text>
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
style={{
|
|
55
|
+
height: '250px',
|
|
56
|
+
}}
|
|
57
|
+
className="mt-5 mb-8"
|
|
58
|
+
>
|
|
59
|
+
<Card className="h-100">
|
|
60
|
+
<Table
|
|
61
|
+
data={data}
|
|
62
|
+
schema={utilitiesSchema}
|
|
63
|
+
size={'standard'}
|
|
64
|
+
headerOptions={{
|
|
65
|
+
withSearch: true,
|
|
66
|
+
}}
|
|
67
|
+
showMenu={false}
|
|
68
|
+
/>
|
|
69
|
+
</Card>
|
|
70
|
+
</div>
|
|
71
|
+
<Heading size="m">Examples</Heading>
|
|
72
|
+
<Paragraph>Here are some representative examples of these classes:</Paragraph>
|
|
73
|
+
|
|
74
|
+
<div className="pl-10 h-25 bg-light w-50">
|
|
75
|
+
<span className="border bg-secondary-lightest p-8 d-inline-block mr-6">border</span>
|
|
76
|
+
<span className="border-top bg-secondary-lightest p-8 d-inline-block mr-6">top</span>
|
|
77
|
+
<span className="border-right bg-secondary-lightest p-8 d-inline-block mr-6">right</span>
|
|
78
|
+
<span className="border-bottom bg-secondary-lightest p-8 d-inline-block mr-6">bottom</span>
|
|
79
|
+
<span className="border-left bg-secondary-lightest p-8 d-inline-block">left</span>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div className="DocPage-codeBlock w-50 pl-10">
|
|
83
|
+
{'<span className="border bg-secondary-lightest p-8 d-inline-block mr-6">border</span>'}
|
|
84
|
+
<br />
|
|
85
|
+
{'<span className="border-top bg-secondary-lightest p-8 d-inline-block mr-6">top</span>'}
|
|
86
|
+
<br />
|
|
87
|
+
{'<span className="border-right bg-secondary-lightest p-8 d-inline-block mr-6">right</span>'}
|
|
88
|
+
<br />
|
|
89
|
+
{'<span className="border-bottom bg-secondary-lightest p-8 d-inline-block mr-6">bottom</span>'}
|
|
90
|
+
<br />
|
|
91
|
+
{'<span className="border-left bg-secondary-lightest p-8 d-inline-block">left</span>'}
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div className="pl-10 h-25 bg-light w-50">
|
|
95
|
+
<span className="border border-0 bg-secondary-lightest p-8 d-inline-block mr-6">border-0</span>
|
|
96
|
+
<span className="border border-top-0 bg-secondary-lightest p-8 d-inline-block mr-6">top-0</span>
|
|
97
|
+
<span className="border border-right-0 bg-secondary-lightest p-8 d-inline-block mr-6">right-0</span>
|
|
98
|
+
<span className="border border-bottom-0 bg-secondary-lightest p-8 d-inline-block mr-6">bottom-0</span>
|
|
99
|
+
<span className="border border-left-0 bg-secondary-lightest p-8 d-inline-block">left-0</span>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div className="DocPage-codeBlock w-50 pl-10">
|
|
103
|
+
{'<span className="border border-0 bg-secondary-lightest p-8 d-inline-block mr-6">border-0</span>'}
|
|
104
|
+
<br />
|
|
105
|
+
{'<span className="border border-top-0 bg-secondary-lightest p-8 d-inline-block mr-6">top-0</span>'}
|
|
106
|
+
<br />
|
|
107
|
+
{'<span className="border border-right-0 bg-secondary-lightest p-8 d-inline-block mr-6">right-0</span>'}
|
|
108
|
+
<br />
|
|
109
|
+
{'<span className="border border-bottom-0 bg-secondary-lightest p-8 d-inline-block mr-6">bottom-0</span>'}
|
|
110
|
+
<br />
|
|
111
|
+
{'<span className="border border-left-0 bg-secondary-lightest p-8 d-inline-block">left-0</span>'}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default {
|
|
119
|
+
title: 'Others/Styles/Border',
|
|
120
|
+
component: border,
|
|
121
|
+
parameters: {
|
|
122
|
+
viewMode: 'story',
|
|
123
|
+
docs: {
|
|
124
|
+
docPage: null,
|
|
125
|
+
page: null,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -12,24 +12,20 @@ const TextValues = {
|
|
|
12
12
|
failedText: 'Failed Text',
|
|
13
13
|
sendingText: 'Sending Text',
|
|
14
14
|
typingText: 'Typing Text',
|
|
15
|
-
msgText: 'Message Text'
|
|
15
|
+
msgText: 'Message Text',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
describe('ChatMessage component prop:type snapshot', () => {
|
|
19
19
|
const mapper: Record<string, any> = {
|
|
20
20
|
type: valueHelper(type, { required: true, iterate: true }),
|
|
21
|
-
text: valueHelper(TextValues.msgText, { required: true })
|
|
21
|
+
text: valueHelper(TextValues.msgText, { required: true }),
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const testFunc = (props: Record<string, any>): void => {
|
|
25
25
|
const attr = filterUndefined(props) as Props;
|
|
26
26
|
|
|
27
27
|
it(testMessageHelper(attr), () => {
|
|
28
|
-
const { asFragment } = render(
|
|
29
|
-
<ChatMessage
|
|
30
|
-
{...attr}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
28
|
+
const { asFragment } = render(<ChatMessage {...attr} />);
|
|
33
29
|
expect(asFragment()).toMatchSnapshot();
|
|
34
30
|
});
|
|
35
31
|
};
|
|
@@ -40,18 +36,14 @@ describe('ChatMessage component prop:type snapshot', () => {
|
|
|
40
36
|
describe('ChatMessage component prop:isTyping snapshot', () => {
|
|
41
37
|
const mapper: Record<string, any> = {
|
|
42
38
|
isTyping: valueHelper(BooleanValue, { iterate: true, required: false }),
|
|
43
|
-
typingText: valueHelper(TextValues.typingText, { required: true })
|
|
39
|
+
typingText: valueHelper(TextValues.typingText, { required: true }),
|
|
44
40
|
};
|
|
45
41
|
|
|
46
42
|
const testFunc = (props: Record<string, any>): void => {
|
|
47
43
|
const attr = filterUndefined(props) as Props;
|
|
48
44
|
|
|
49
45
|
it(testMessageHelper(attr), () => {
|
|
50
|
-
const { asFragment } = render(
|
|
51
|
-
<ChatMessage
|
|
52
|
-
{...attr}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
46
|
+
const { asFragment } = render(<ChatMessage {...attr} />);
|
|
55
47
|
expect(asFragment()).toMatchSnapshot();
|
|
56
48
|
});
|
|
57
49
|
};
|
|
@@ -61,18 +53,14 @@ describe('ChatMessage component prop:isTyping snapshot', () => {
|
|
|
61
53
|
|
|
62
54
|
describe('ChatMessage component prop:text snapshot', () => {
|
|
63
55
|
const mapper: Record<string, any> = {
|
|
64
|
-
text: valueHelper(TextValues.msgText, { required: true })
|
|
56
|
+
text: valueHelper(TextValues.msgText, { required: true }),
|
|
65
57
|
};
|
|
66
58
|
|
|
67
59
|
const testFunc = (props: Record<string, any>): void => {
|
|
68
60
|
const attr = filterUndefined(props) as Props;
|
|
69
61
|
|
|
70
62
|
it(testMessageHelper(attr), () => {
|
|
71
|
-
const { asFragment } = render(
|
|
72
|
-
<ChatMessage
|
|
73
|
-
{...attr}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
63
|
+
const { asFragment } = render(<ChatMessage {...attr} />);
|
|
76
64
|
expect(asFragment()).toMatchSnapshot();
|
|
77
65
|
});
|
|
78
66
|
};
|
|
@@ -84,11 +72,7 @@ describe('ChatMessage component with different values of prop:type ', () => {
|
|
|
84
72
|
type.forEach((value) => {
|
|
85
73
|
it(`check for Message Box to have class Box--${value} if type is ${value}`, () => {
|
|
86
74
|
const { getByTestId } = render(
|
|
87
|
-
<ChatMessage
|
|
88
|
-
text={TextValues.msgText}
|
|
89
|
-
type={value}
|
|
90
|
-
typingText={TextValues.typingText}
|
|
91
|
-
/>
|
|
75
|
+
<ChatMessage text={TextValues.msgText} type={value} typingText={TextValues.typingText} />
|
|
92
76
|
);
|
|
93
77
|
expect(getByTestId('DesignSystem-ChatMessage--Box')).toHaveClass(`Box--${value}`);
|
|
94
78
|
});
|
|
@@ -98,12 +82,7 @@ describe('ChatMessage component with different values of prop:type ', () => {
|
|
|
98
82
|
describe('ChatMessage component prop:isTyping', () => {
|
|
99
83
|
it('check for properties when isTyping is true', () => {
|
|
100
84
|
const { getByTestId } = render(
|
|
101
|
-
<ChatMessage
|
|
102
|
-
type="incoming"
|
|
103
|
-
text={TextValues.msgText}
|
|
104
|
-
isTyping={true}
|
|
105
|
-
typingText={TextValues.typingText}
|
|
106
|
-
/>
|
|
85
|
+
<ChatMessage type="incoming" text={TextValues.msgText} isTyping={true} typingText={TextValues.typingText} />
|
|
107
86
|
);
|
|
108
87
|
expect(getByTestId('DesignSystem-Text').textContent).toMatch(TextValues.typingText);
|
|
109
88
|
expect(getByTestId('DesignSystem-ChatMessage--Box')).toHaveClass('Box-incoming--withStatus');
|
|
@@ -112,12 +91,7 @@ describe('ChatMessage component prop:isTyping', () => {
|
|
|
112
91
|
|
|
113
92
|
it('check for text Message when isTyping is false', () => {
|
|
114
93
|
const { getByTestId } = render(
|
|
115
|
-
<ChatMessage
|
|
116
|
-
type="incoming"
|
|
117
|
-
text={TextValues.msgText}
|
|
118
|
-
isTyping={false}
|
|
119
|
-
typingText={TextValues.typingText}
|
|
120
|
-
/>
|
|
94
|
+
<ChatMessage type="incoming" text={TextValues.msgText} isTyping={false} typingText={TextValues.typingText} />
|
|
121
95
|
);
|
|
122
96
|
expect(getByTestId('DesignSystem-Text').textContent).toMatch(TextValues.msgText);
|
|
123
97
|
expect(getByTestId('DesignSystem-ChatMessage--Box')).not.toHaveClass('Box-incoming--withStatus');
|
|
@@ -148,7 +122,7 @@ describe('ChatMessage component prop:statusOptions with type:failed', () => {
|
|
|
148
122
|
typingText={TextValues.typingText}
|
|
149
123
|
statusOptions={{
|
|
150
124
|
type: 'failed',
|
|
151
|
-
failedText: TextValues.failedText
|
|
125
|
+
failedText: TextValues.failedText,
|
|
152
126
|
}}
|
|
153
127
|
/>
|
|
154
128
|
);
|
|
@@ -180,7 +154,7 @@ describe('ChatMessage component prop:statusOptions with type:sending', () => {
|
|
|
180
154
|
typingText={TextValues.typingText}
|
|
181
155
|
statusOptions={{
|
|
182
156
|
type: 'sending',
|
|
183
|
-
sendingText: TextValues.sendingText
|
|
157
|
+
sendingText: TextValues.sendingText,
|
|
184
158
|
}}
|
|
185
159
|
/>
|
|
186
160
|
);
|
|
@@ -194,7 +168,7 @@ describe('ChatMessage component prop:statusOptions with type:sending', () => {
|
|
|
194
168
|
type="incoming"
|
|
195
169
|
typingText={TextValues.typingText}
|
|
196
170
|
statusOptions={{
|
|
197
|
-
type: 'sending'
|
|
171
|
+
type: 'sending',
|
|
198
172
|
}}
|
|
199
173
|
/>
|
|
200
174
|
);
|
|
@@ -211,7 +185,7 @@ describe('ChatMessage component prop:statusOptions with type:sent', () => {
|
|
|
211
185
|
typingText={TextValues.typingText}
|
|
212
186
|
statusOptions={{
|
|
213
187
|
type: 'sent',
|
|
214
|
-
time: timeStr
|
|
188
|
+
time: timeStr,
|
|
215
189
|
}}
|
|
216
190
|
/>
|
|
217
191
|
);
|
|
@@ -227,7 +201,7 @@ describe('ChatMessage component prop:statusOptions with type:sent', () => {
|
|
|
227
201
|
typingText={TextValues.typingText}
|
|
228
202
|
statusOptions={{
|
|
229
203
|
type: 'sent',
|
|
230
|
-
time: timeNum
|
|
204
|
+
time: timeNum,
|
|
231
205
|
}}
|
|
232
206
|
/>
|
|
233
207
|
);
|
|
@@ -245,7 +219,7 @@ describe('ChatMessage component prop:statusOptions with type:read', () => {
|
|
|
245
219
|
typingText={TextValues.typingText}
|
|
246
220
|
statusOptions={{
|
|
247
221
|
type: 'read',
|
|
248
|
-
readText: TextValues.readText
|
|
222
|
+
readText: TextValues.readText,
|
|
249
223
|
}}
|
|
250
224
|
/>
|
|
251
225
|
);
|
|
@@ -259,7 +233,7 @@ describe('ChatMessage component prop:statusOptions with type:read', () => {
|
|
|
259
233
|
type="incoming"
|
|
260
234
|
typingText={TextValues.typingText}
|
|
261
235
|
statusOptions={{
|
|
262
|
-
type: 'read'
|
|
236
|
+
type: 'read',
|
|
263
237
|
}}
|
|
264
238
|
/>
|
|
265
239
|
);
|
|
@@ -275,7 +249,7 @@ describe('ChatMessage component prop:statusOptions with type:read', () => {
|
|
|
275
249
|
statusOptions={{
|
|
276
250
|
type: 'read',
|
|
277
251
|
readText: TextValues.readText,
|
|
278
|
-
time: timeStr
|
|
252
|
+
time: timeStr,
|
|
279
253
|
}}
|
|
280
254
|
/>
|
|
281
255
|
);
|
|
@@ -292,7 +266,7 @@ describe('ChatMessage component prop:statusOptions with type:urgent', () => {
|
|
|
292
266
|
type="incoming"
|
|
293
267
|
typingText={TextValues.typingText}
|
|
294
268
|
statusOptions={{
|
|
295
|
-
type: 'urgent'
|
|
269
|
+
type: 'urgent',
|
|
296
270
|
}}
|
|
297
271
|
/>
|
|
298
272
|
);
|
|
@@ -307,7 +281,7 @@ describe('ChatMessage component prop:statusOptions with type:urgent', () => {
|
|
|
307
281
|
typingText={TextValues.typingText}
|
|
308
282
|
statusOptions={{
|
|
309
283
|
type: 'urgent',
|
|
310
|
-
time: timeStr
|
|
284
|
+
time: timeStr,
|
|
311
285
|
}}
|
|
312
286
|
/>
|
|
313
287
|
);
|