feat(validator): add validation support for RadioGroup
(#234)
* Removed div element from RadioGroup * Fixed first RadioGroup unit test
This commit is contained in:
parent
25ce684d23
commit
5aa7c19874
2 changed files with 4 additions and 5 deletions
|
@ -21,11 +21,10 @@ const options = control.options.map((option: string | ControlOption) => {
|
||||||
return option;
|
return option;
|
||||||
});
|
});
|
||||||
---
|
---
|
||||||
|
<br>
|
||||||
{
|
{
|
||||||
options.map((option: ControlOption, index: number) => (
|
options.map((option: ControlOption, index: number) => (
|
||||||
<div class="radio-option">
|
<input
|
||||||
<input
|
|
||||||
type="radio"
|
type="radio"
|
||||||
id={control.id + '-' + index}
|
id={control.id + '-' + index}
|
||||||
name={control.name}
|
name={control.name}
|
||||||
|
@ -36,6 +35,6 @@ const options = control.options.map((option: string | ControlOption) => {
|
||||||
data-validation-on={control.triggerValidationOn ? control.triggerValidationOn : null}
|
data-validation-on={control.triggerValidationOn ? control.triggerValidationOn : null}
|
||||||
/>
|
/>
|
||||||
<label for={control.id + '-' + index}>{option.label}</label>
|
<label for={control.id + '-' + index}>{option.label}</label>
|
||||||
</div>
|
<br>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe('RadioGroup.astro test', () => {
|
||||||
it('Should render all radio options', async () => {
|
it('Should render all radio options', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
const expectedOptions = 3;
|
const expectedOptions = 3;
|
||||||
const element = /radio-option/g;
|
const element = /type="radio"/g;
|
||||||
const props = {
|
const props = {
|
||||||
control: {
|
control: {
|
||||||
label: 'FAKE LABEL',
|
label: 'FAKE LABEL',
|
||||||
|
|
Loading…
Reference in a new issue