Skip to content

Commit c713d06

Browse files
Pavitra KhatriPavitra Khatri
authored andcommitted
Add id to the outer div
1 parent 5ab9827 commit c713d06

File tree

17 files changed

+783
-14
lines changed

17 files changed

+783
-14
lines changed

package-lock.json

Lines changed: 763 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-vanilla-components/__tests__/components/FileUpload.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ describe("File Upload", () => {
256256
test('labels and inputs are linked with for and id attribute', async () => {
257257
let { renderResponse } = await helper(field);
258258
const input = await renderResponse.container.getElementsByClassName('cmp-adaptiveform-fileinput__widget');
259-
const label = await renderResponse.queryByText(field.label.value);
260-
expect(input[0]?.getAttribute('id')).toEqual(label?.getAttribute('for'));
259+
const label = await renderResponse.container.getElementsByClassName('cmp-adaptiveform-fileinput__widgetlabel');
260+
expect(input[0]?.getAttribute('id')).toEqual(label[0]?.getAttribute('for'));
261261
});
262262

263263
test('Drag and drop files', async () => {

packages/react-vanilla-components/src/components/Accordion/Accordion.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const Accordion = (props: PROPS_PANEL) => {
5151
<div
5252
className={`cmp-accordion ${appliedCssClassNames || ''}`}
5353
data-cmp-is="adaptiveFormAccordion"
54+
id={id}
5455
data-cmp-single-expansion="true"
5556
data-placeholder-text="false"
5657
data-cmp-visible={visible}

packages/react-vanilla-components/src/components/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const Button = (props: PROPS) => {
3030
}, [props.dispatchClick]);
3131

3232
return (
33-
<div className={`cmp-adaptiveform-button ${appliedCssClassNames || ''}`}>
33+
<div className={`cmp-adaptiveform-button ${appliedCssClassNames || ''}`} id={id}>
3434
<FieldWrapper
3535
bemBlock='cmp-adaptiveform-checkbox'
3636
label={label}

packages/react-vanilla-components/src/components/CheckBox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const CheckBox = (props: PROPS) => {
3434
<div
3535
className={`cmp-adaptiveform-checkbox cmp-adaptiveform-checkbox--${selectedValue === value ? 'filled' : 'empty'} ${appliedCssClassNames || ''}`}
3636
data-cmp-is="adaptiveFormCheckBox"
37+
id={id}
3738
data-cmp-visible={visible}
3839
data-cmp-enabled={enabled}
3940
data-cmp-required={required}

packages/react-vanilla-components/src/components/CheckBoxGroup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const CheckBoxGroup = (props: PROPS) => {
5757
<div
5858
className={`cmp-adaptiveform-checkboxgroup cmp-adaptiveform-checkboxgroup--${newVal.length ? 'filled' : 'empty'} ${appliedCssClassNames || ''}`}
5959
data-cmp-is="adaptiveFormCheckBoxGroup"
60+
id={id}
6061
data-cmp-visible={visible}
6162
data-cmp-enabled={enabled}
6263
data-cmp-required={required}

packages/react-vanilla-components/src/components/DateInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const DateInput = (props: PROPS) => {
4444
<div
4545
className={`cmp-adaptiveform-datepicker cmp-adaptiveform-datepicker--${value ? 'filled' : 'empty'} ${appliedCssClassNames || ''}`}
4646
data-cmp-is="adaptiveFormDatePicker"
47+
id={id}
4748
data-cmp-visible={visible}
4849
data-cmp-enabled={enabled}
4950
data-cmp-required={required}

packages/react-vanilla-components/src/components/DropDown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const DropDown = (props: PROPS) => {
3636
<div
3737
className={`cmp-adaptiveform-dropdown cmp-adaptiveform-dropdown--${value ? 'filled' : 'empty'} ${appliedCssClassNames || ''}`}
3838
data-cmp-is="adaptiveFormDropDown"
39+
id={id}
3940
data-cmp-visible={visible}
4041
data-cmp-enabled={enabled}
4142
data-cmp-required={required}

packages/react-vanilla-components/src/components/FileUpload.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const FileUpload = (props: PROPS) => {
104104
className={`cmp-adaptiveform-fileinput cmp-adaptiveform-fileinput--${
105105
isFilled ? 'filled' : 'empty'
106106
} ${appliedCssClassNames || ''}`}
107+
id={id}
107108
data-cmp-is="adaptiveFormFileInput"
108109
data-cmp-visible={visible}
109110
data-cmp-enabled={enabled}
@@ -133,15 +134,15 @@ const FileUpload = (props: PROPS) => {
133134
{properties?.dragDropText}
134135
</div>
135136
<label
136-
htmlFor={id}
137+
htmlFor={`${id}_widget`}
137138
className="cmp-adaptiveform-fileinput__widgetlabel"
138139
>
139140
Attach
140141
</label>
141142
<input
142143
ref={fileInputField}
143144
className="cmp-adaptiveform-fileinput__widget"
144-
id={id}
145+
id={`${id}_widget`}
145146
type="file"
146147
name={name}
147148
onChange={fileUploadHandler}

packages/react-vanilla-components/src/components/HCaptcha.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const HCaptchaComponent = (props: PROPS) => {
3737
<div
3838
className={`${bemClass} ${bemClass}--${value ? 'filled' : 'empty'} ${appliedCssClassNames || ''}`}
3939
data-cmp-is="adaptiveFormHCaptcha"
40+
id={props.id}
4041
data-cmp-visible={visible}
4142
data-cmp-enabled={enabled}
4243
data-cmp-required={required}

0 commit comments

Comments
 (0)