Skip to content

Commit b1e869f

Browse files
authored
fix(radio-button): display validation message in parent group (#9218)
**Related Issue:** #9220 ## Summary Fix validation messages not displaying on `calcite-radio-button-group` during form submission. Note: `calcite-radio-button`s need to be in a group, or else they will not display validation messages based on the `required` constraint. The formAssociated common test needs to be updated to support a parent component wrapping the form associated element. Currently it assumes the first element it finds will be the form associated component to test. I will do this in a follow up PR, likely after the release.
1 parent 0cfe812 commit b1e869f

File tree

5 files changed

+510
-30
lines changed

5 files changed

+510
-30
lines changed

packages/calcite-components/src/components/radio-button/radio-button.e2e.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,40 @@ describe("calcite-radio-button", () => {
575575
});
576576

577577
describe("is form-associated", () => {
578-
formAssociated("calcite-radio-button", { testValue: true, inputType: "radio" });
578+
describe("no group", () => {
579+
formAssociated("calcite-radio-button", {
580+
testValue: true,
581+
inputType: "radio",
582+
});
583+
});
584+
585+
// skipped until the util supports a parent component wrapping the form associated element(s)
586+
// https://github.com/Esri/calcite-design-system/issues/9221
587+
describe.skip("group", () => {
588+
formAssociated(
589+
html`
590+
<calcite-radio-button-group name="using" required>
591+
<calcite-label layout="inline">
592+
Yes
593+
<calcite-radio-button value="yes" required></calcite-radio-button>
594+
</calcite-label>
595+
<calcite-label layout="inline">
596+
No
597+
<calcite-radio-button value="no" required></calcite-radio-button>
598+
</calcite-label>
599+
<calcite-label layout="inline">
600+
Maybe
601+
<calcite-radio-button value="maybe" required></calcite-radio-button>
602+
</calcite-label>
603+
</calcite-radio-button-group>
604+
`,
605+
{
606+
testValue: true,
607+
inputType: "radio",
608+
validation: true,
609+
changeValueKeys: ["Space"],
610+
},
611+
);
612+
});
579613
});
580614
});

0 commit comments

Comments
 (0)