feat(validator): add validation support for RadioGroup (#234)

* Removed div element from RadioGroup

* Fixed first RadioGroup unit test
This commit is contained in:
Alexander Samaniego 2022-12-12 08:54:03 -05:00 committed by GitHub
parent 25ce684d23
commit 5aa7c19874
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -21,11 +21,10 @@ const options = control.options.map((option: string | ControlOption) => {
return option;
});
---
<br>
{
options.map((option: ControlOption, index: number) => (
<div class="radio-option">
<input
<input
type="radio"
id={control.id + '-' + index}
name={control.name}
@ -36,6 +35,6 @@ const options = control.options.map((option: string | ControlOption) => {
data-validation-on={control.triggerValidationOn ? control.triggerValidationOn : null}
/>
<label for={control.id + '-' + index}>{option.label}</label>
</div>
<br>
))
}

View file

@ -12,7 +12,7 @@ describe('RadioGroup.astro test', () => {
it('Should render all radio options', async () => {
// arrange
const expectedOptions = 3;
const element = /radio-option/g;
const element = /type="radio"/g;
const props = {
control: {
label: 'FAKE LABEL',