@zohodesk/components 1.0.0-temp-199.22 → 1.0.0-temp-249.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/README.md +29 -0
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +6 -0
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +6 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +6 -0
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +5 -5
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +6 -6
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +3 -3
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -3
- package/es/ListItem/ListItem.js +0 -1
- package/es/ListItem/ListItem.module.css +18 -17
- package/es/ListItem/ListItemWithAvatar.js +2 -4
- package/es/ListItem/ListItemWithCheckBox.js +2 -4
- package/es/ListItem/ListItemWithIcon.js +2 -4
- package/es/ListItem/ListItemWithRadio.js +2 -4
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -6
- package/es/MultiSelect/MultiSelect.js +2 -2
- package/es/MultiSelect/Suggestions.js +2 -7
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +1 -1
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +1 -1
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +1 -1
- package/es/MultiSelect/props/defaultProps.js +0 -2
- package/es/MultiSelect/props/propTypes.js +3 -11
- package/es/Provider/LibraryContext.js +11 -3
- package/es/Select/GroupSelect.js +1 -1
- package/es/Select/Select.js +5 -3
- package/es/Select/SelectWithAvatar.js +3 -3
- package/es/Select/SelectWithIcon.js +3 -10
- package/es/Select/__tests__/Select.spec.js +5 -0
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -1
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +111 -121
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -1
- package/es/Select/props/defaultProps.js +2 -4
- package/es/Select/props/propTypes.js +5 -12
- package/es/TextBoxIcon/TextBoxIcon.js +0 -1
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +39 -39
- package/es/common/common.module.css +1 -1
- package/es/shared/InputFieldLine/InputFieldLine.js +2 -1
- package/es/shared/InputFieldLine/InputFieldLine.module.css +13 -7
- package/es/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/es/shared/InputFieldLine/props/defaultProps.js +2 -2
- package/es/shared/InputFieldLine/props/propTypes.js +1 -1
- package/es/v1/Label/Label.js +95 -33
- package/es/v1/Label/__tests__/Label.spec.js +214 -0
- package/es/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +451 -0
- package/es/v1/Label/constants/index.js +8 -0
- package/es/v1/Label/css/Label_v1.module.css +42 -0
- package/es/v1/Label/css/cssJSLogic.js +44 -0
- package/es/v1/Label/props/defaultProps.js +14 -9
- package/es/v1/Label/props/propTypes.js +34 -14
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +5 -5
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +6 -6
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +3 -3
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -3
- package/lib/ListItem/ListItem.js +0 -1
- package/lib/ListItem/ListItem.module.css +18 -17
- package/lib/ListItem/ListItemWithAvatar.js +3 -5
- package/lib/ListItem/ListItemWithCheckBox.js +2 -4
- package/lib/ListItem/ListItemWithIcon.js +3 -5
- package/lib/ListItem/ListItemWithRadio.js +2 -4
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +1 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -8
- package/lib/MultiSelect/MultiSelect.js +2 -2
- package/lib/MultiSelect/Suggestions.js +2 -6
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +1 -1
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +1 -1
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +1 -1
- package/lib/MultiSelect/props/defaultProps.js +0 -2
- package/lib/MultiSelect/props/propTypes.js +5 -13
- package/lib/Provider/LibraryContext.js +11 -3
- package/lib/Select/GroupSelect.js +1 -2
- package/lib/Select/Select.js +8 -5
- package/lib/Select/SelectWithAvatar.js +3 -4
- package/lib/Select/SelectWithIcon.js +3 -10
- package/lib/Select/__tests__/Select.spec.js +5 -0
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -1
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +111 -121
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -1
- package/lib/Select/props/defaultProps.js +3 -5
- package/lib/Select/props/propTypes.js +5 -12
- package/lib/TextBoxIcon/TextBoxIcon.js +0 -1
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +39 -39
- package/lib/common/common.module.css +1 -1
- package/lib/shared/InputFieldLine/InputFieldLine.js +2 -1
- package/lib/shared/InputFieldLine/InputFieldLine.module.css +13 -7
- package/lib/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/lib/shared/InputFieldLine/props/defaultProps.js +2 -2
- package/lib/shared/InputFieldLine/props/propTypes.js +1 -1
- package/lib/v1/Label/Label.js +103 -36
- package/lib/v1/Label/__tests__/Label.spec.js +221 -0
- package/lib/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +451 -0
- package/lib/v1/Label/constants/index.js +16 -0
- package/lib/v1/Label/css/Label_v1.module.css +42 -0
- package/lib/v1/Label/css/cssJSLogic.js +45 -0
- package/lib/v1/Label/props/defaultProps.js +16 -11
- package/lib/v1/Label/props/propTypes.js +36 -16
- package/package.json +10 -10
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
customProps: PropTypes.shape({ ...ContainerProps
|
|
13
13
|
}),
|
|
14
14
|
onClick: PropTypes.func,
|
|
15
|
-
size: PropTypes.oneOf(['medium', 'xmedium']),
|
|
15
|
+
size: PropTypes.oneOf(['auto', 'medium', 'xmedium']),
|
|
16
16
|
border: PropTypes.oneOf(['bottom', 'all', 'none']),
|
|
17
17
|
borderColor: PropTypes.oneOf(['default', 'dark', 'error', 'transparent']),
|
|
18
18
|
children: PropTypes.node,
|
package/es/v1/Label/Label.js
CHANGED
|
@@ -1,40 +1,102 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React from 'react'; // props
|
|
2
|
+
|
|
3
|
+
import defaultProps from "./props/defaultProps";
|
|
4
|
+
import propTypes from "./props/propTypes"; // methods
|
|
5
|
+
|
|
6
|
+
import cssJSLogic from "./css/cssJSLogic";
|
|
7
|
+
import { renderNode } from '@zohodesk/utils'; // hoc
|
|
8
|
+
|
|
9
|
+
import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry'; // constants
|
|
10
|
+
|
|
11
|
+
import { DISPLAY_MODE, FONT_SIZE } from "./constants"; // components
|
|
12
|
+
|
|
13
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
14
|
+
import Typography from "../../Typography/Typography"; // css
|
|
15
|
+
|
|
16
|
+
import style from "./css/Label_v1.module.css";
|
|
17
|
+
|
|
18
|
+
const Label = props => {
|
|
7
19
|
const {
|
|
8
|
-
text,
|
|
9
|
-
type,
|
|
10
|
-
palette,
|
|
11
|
-
size,
|
|
12
|
-
clipped,
|
|
13
20
|
htmlFor,
|
|
14
|
-
title,
|
|
15
21
|
onClick,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
text,
|
|
23
|
+
customId,
|
|
24
|
+
testId,
|
|
25
|
+
tagAttributes,
|
|
26
|
+
a11yAttributes,
|
|
27
|
+
customProps,
|
|
28
|
+
isRequired,
|
|
29
|
+
requiredType,
|
|
30
|
+
isClipped,
|
|
31
|
+
size,
|
|
32
|
+
fontWeight,
|
|
33
|
+
layout,
|
|
34
|
+
renderRightPlaceholderNode,
|
|
35
|
+
renderLeftPlaceholderNode,
|
|
36
|
+
i18nKeys
|
|
22
37
|
} = props;
|
|
23
38
|
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
+
container: tagAttributes_container,
|
|
40
|
+
label: tagAttributes_label
|
|
41
|
+
} = tagAttributes;
|
|
42
|
+
const {
|
|
43
|
+
container: a11yAttributes_container,
|
|
44
|
+
label: a11yAttributes_label
|
|
45
|
+
} = a11yAttributes;
|
|
46
|
+
const {
|
|
47
|
+
container: customProps_container,
|
|
48
|
+
label: customProps_label
|
|
49
|
+
} = customProps;
|
|
50
|
+
const {
|
|
51
|
+
requiredText: i18n_requiredText = 'Required'
|
|
52
|
+
} = i18nKeys;
|
|
53
|
+
const {
|
|
54
|
+
labelClass,
|
|
55
|
+
requiredClass,
|
|
56
|
+
containerClass
|
|
57
|
+
} = cssJSLogic({ ...props,
|
|
58
|
+
style
|
|
59
|
+
});
|
|
60
|
+
const a11yAttributes_requiredText = {
|
|
61
|
+
'aria-hidden': 'true'
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const renderRequired = () => /*#__PURE__*/React.createElement(Typography, {
|
|
65
|
+
$ui_tagName: "span",
|
|
66
|
+
$ui_className: requiredClass,
|
|
67
|
+
$a11yAttributes_text: a11yAttributes_requiredText,
|
|
68
|
+
$ui_size: FONT_SIZE[size],
|
|
69
|
+
$ui_weight: fontWeight,
|
|
70
|
+
$i18n_dataTitle: ""
|
|
71
|
+
}, requiredType === 'text' ? `(${i18n_requiredText})` : '*');
|
|
72
|
+
|
|
73
|
+
return /*#__PURE__*/React.createElement(Flex, { ...customProps_container,
|
|
74
|
+
$tagAttributes_container: { ...tagAttributes_container,
|
|
75
|
+
'data-selector-id': customId
|
|
76
|
+
},
|
|
77
|
+
$ui_displayMode: DISPLAY_MODE[layout],
|
|
78
|
+
$ui_alignItems: "center",
|
|
79
|
+
$a11yAttributes_container: a11yAttributes_container,
|
|
80
|
+
testId: testId,
|
|
81
|
+
customId: customId,
|
|
82
|
+
$ui_className: containerClass
|
|
83
|
+
}, renderNode(renderLeftPlaceholderNode), /*#__PURE__*/React.createElement(Typography, { ...customProps_label,
|
|
84
|
+
$tagAttributes_text: { ...tagAttributes_label,
|
|
85
|
+
htmlFor,
|
|
86
|
+
onClick
|
|
87
|
+
},
|
|
88
|
+
$ui_tagName: "label",
|
|
89
|
+
$ui_className: labelClass,
|
|
90
|
+
$i18n_dataTitle: text,
|
|
91
|
+
$a11yAttributes_text: a11yAttributes_label,
|
|
92
|
+
$ui_size: FONT_SIZE[size],
|
|
93
|
+
$ui_weight: fontWeight,
|
|
94
|
+
$flag_dotted: isClipped
|
|
95
|
+
}, text, isRequired && !isClipped ? renderRequired() : null), isRequired && isClipped ? renderRequired() : null, renderNode(renderRightPlaceholderNode));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default withComponentRegistrar(Label, {
|
|
99
|
+
name: 'ZDC_V1_Label'
|
|
100
|
+
});
|
|
39
101
|
Label.defaultProps = defaultProps;
|
|
40
102
|
Label.propTypes = propTypes;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import Label from "../Label"; // Hoisted enum values (PropTypes.oneOf enforcement)
|
|
4
|
+
|
|
5
|
+
const REQUIRED_TYPE_VALUES = ['asterisk', 'text'];
|
|
6
|
+
const SIZE_VALUES = ['small', 'medium'];
|
|
7
|
+
const PALETTE_VALUES = ['default', 'secondary'];
|
|
8
|
+
const TEXT_WEIGHT_VALUES = ['regular', 'semibold'];
|
|
9
|
+
const LAYOUT_VALUES = ['inline', 'block'];
|
|
10
|
+
afterEach(cleanup);
|
|
11
|
+
describe('Label - Snapshot', () => {
|
|
12
|
+
test('Render with default props', () => {
|
|
13
|
+
const {
|
|
14
|
+
asFragment
|
|
15
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
16
|
+
text: "Label text"
|
|
17
|
+
}));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
test.each(REQUIRED_TYPE_VALUES)('Render with requiredType=%s', value => {
|
|
21
|
+
const {
|
|
22
|
+
asFragment
|
|
23
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
24
|
+
text: "Label text",
|
|
25
|
+
isRequired: true,
|
|
26
|
+
requiredType: value
|
|
27
|
+
}));
|
|
28
|
+
expect(asFragment()).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
test.each(SIZE_VALUES)('Render with size=%s', value => {
|
|
31
|
+
const {
|
|
32
|
+
asFragment
|
|
33
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
34
|
+
text: "Label text",
|
|
35
|
+
size: value
|
|
36
|
+
}));
|
|
37
|
+
expect(asFragment()).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
test.each(PALETTE_VALUES)('Render with palette=%s', value => {
|
|
40
|
+
const {
|
|
41
|
+
asFragment
|
|
42
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
43
|
+
text: "Label text",
|
|
44
|
+
palette: value
|
|
45
|
+
}));
|
|
46
|
+
expect(asFragment()).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
test.each(TEXT_WEIGHT_VALUES)('Render with fontWeight=%s', value => {
|
|
49
|
+
const {
|
|
50
|
+
asFragment
|
|
51
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
52
|
+
text: "Label text",
|
|
53
|
+
fontWeight: value
|
|
54
|
+
}));
|
|
55
|
+
expect(asFragment()).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
test.each(LAYOUT_VALUES)('Render with layout=%s', value => {
|
|
58
|
+
const {
|
|
59
|
+
asFragment
|
|
60
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
61
|
+
text: "Label text",
|
|
62
|
+
layout: value
|
|
63
|
+
}));
|
|
64
|
+
expect(asFragment()).toMatchSnapshot();
|
|
65
|
+
});
|
|
66
|
+
test('Render with shouldHighlightRequired=true', () => {
|
|
67
|
+
const {
|
|
68
|
+
asFragment
|
|
69
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
70
|
+
text: "Label text",
|
|
71
|
+
isRequired: true,
|
|
72
|
+
shouldHighlightRequired: true
|
|
73
|
+
}));
|
|
74
|
+
expect(asFragment()).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
test('Render with isClipped=true', () => {
|
|
77
|
+
const {
|
|
78
|
+
asFragment
|
|
79
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
80
|
+
text: "Label text",
|
|
81
|
+
isClipped: true
|
|
82
|
+
}));
|
|
83
|
+
expect(asFragment()).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
test('Render with isRequired=true', () => {
|
|
86
|
+
const {
|
|
87
|
+
asFragment
|
|
88
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
89
|
+
text: "Label text",
|
|
90
|
+
isRequired: true
|
|
91
|
+
}));
|
|
92
|
+
expect(asFragment()).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
test('Render with isRequired=true isClipped=true', () => {
|
|
95
|
+
const {
|
|
96
|
+
asFragment
|
|
97
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
98
|
+
text: "Label text",
|
|
99
|
+
isRequired: true,
|
|
100
|
+
isClipped: true
|
|
101
|
+
}));
|
|
102
|
+
expect(asFragment()).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
test('Render with isDisabled=true', () => {
|
|
105
|
+
const {
|
|
106
|
+
asFragment
|
|
107
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
108
|
+
text: "Label text",
|
|
109
|
+
isDisabled: true
|
|
110
|
+
}));
|
|
111
|
+
expect(asFragment()).toMatchSnapshot();
|
|
112
|
+
});
|
|
113
|
+
test('Render with isReadOnly=true', () => {
|
|
114
|
+
const {
|
|
115
|
+
asFragment
|
|
116
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
117
|
+
text: "Label text",
|
|
118
|
+
isReadOnly: true
|
|
119
|
+
}));
|
|
120
|
+
expect(asFragment()).toMatchSnapshot();
|
|
121
|
+
});
|
|
122
|
+
test('Render with htmlFor', () => {
|
|
123
|
+
const {
|
|
124
|
+
asFragment
|
|
125
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
126
|
+
text: "Label text",
|
|
127
|
+
htmlFor: "input-id"
|
|
128
|
+
}));
|
|
129
|
+
expect(asFragment()).toMatchSnapshot();
|
|
130
|
+
});
|
|
131
|
+
test('Render with i18nKeys', () => {
|
|
132
|
+
const {
|
|
133
|
+
asFragment
|
|
134
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
135
|
+
text: "Label text",
|
|
136
|
+
isRequired: true,
|
|
137
|
+
requiredType: "text",
|
|
138
|
+
i18nKeys: {
|
|
139
|
+
requiredText: 'Custom Required'
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
expect(asFragment()).toMatchSnapshot();
|
|
143
|
+
});
|
|
144
|
+
test('Render with customClass', () => {
|
|
145
|
+
const {
|
|
146
|
+
asFragment
|
|
147
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
148
|
+
text: "Label text",
|
|
149
|
+
customClass: {
|
|
150
|
+
container: 'custom-container',
|
|
151
|
+
label: 'custom-label'
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
expect(asFragment()).toMatchSnapshot();
|
|
155
|
+
});
|
|
156
|
+
test('Render with customProps', () => {
|
|
157
|
+
const {
|
|
158
|
+
asFragment
|
|
159
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
160
|
+
text: "Label text",
|
|
161
|
+
customProps: {
|
|
162
|
+
container: {
|
|
163
|
+
$flag_shrink: true
|
|
164
|
+
},
|
|
165
|
+
label: {
|
|
166
|
+
$ui_lineClamp: '2'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
expect(asFragment()).toMatchSnapshot();
|
|
171
|
+
});
|
|
172
|
+
test('Render with customId and testId', () => {
|
|
173
|
+
const {
|
|
174
|
+
asFragment
|
|
175
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
176
|
+
text: "Label text",
|
|
177
|
+
customId: "label-customId",
|
|
178
|
+
testId: "label-testId"
|
|
179
|
+
}));
|
|
180
|
+
expect(asFragment()).toMatchSnapshot();
|
|
181
|
+
});
|
|
182
|
+
test('Render with tag attributes', () => {
|
|
183
|
+
const {
|
|
184
|
+
asFragment
|
|
185
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
186
|
+
text: "Label text",
|
|
187
|
+
tagAttributes: {
|
|
188
|
+
container: {
|
|
189
|
+
'data-custom-attr': 'true'
|
|
190
|
+
},
|
|
191
|
+
label: {
|
|
192
|
+
'data-custom-attr': 'true'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
expect(asFragment()).toMatchSnapshot();
|
|
197
|
+
});
|
|
198
|
+
test('Render with a11y attributes', () => {
|
|
199
|
+
const {
|
|
200
|
+
asFragment
|
|
201
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
202
|
+
text: "Label text",
|
|
203
|
+
a11yAttributes: {
|
|
204
|
+
container: {
|
|
205
|
+
role: 'group'
|
|
206
|
+
},
|
|
207
|
+
label: {
|
|
208
|
+
'aria-label': 'Custom label'
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}));
|
|
212
|
+
expect(asFragment()).toMatchSnapshot();
|
|
213
|
+
});
|
|
214
|
+
});
|