chore(lion-radio-group): add tests for serialized value
This commit is contained in:
parent
1adeb46e34
commit
7f12d3cd2c
1 changed files with 27 additions and 0 deletions
|
|
@ -211,4 +211,31 @@ describe('<lion-radio-group>', () => {
|
|||
el.formElements['gender[]'][0].choiceChecked = true;
|
||||
expect(el.error.required).to.be.undefined;
|
||||
});
|
||||
|
||||
it('returns serialized value', async () => {
|
||||
const group = await fixture(html`
|
||||
<lion-radio-group .errorValidators="${[['required']]}">
|
||||
<lion-radio name="gender[]" .choiceValue=${'male'}></lion-radio>
|
||||
<lion-radio name="gender[]" .choiceValue=${'female'}></lion-radio>
|
||||
</lion-radio-group>
|
||||
`);
|
||||
|
||||
await nextFrame();
|
||||
group.formElements['gender[]'][0].choiceChecked = true;
|
||||
|
||||
expect(group.serializedValue).to.deep.equal({ checked: true, value: 'male' });
|
||||
});
|
||||
|
||||
it('returns serialized value on unchecked state', async () => {
|
||||
const group = await fixture(html`
|
||||
<lion-radio-group .errorValidators="${[['required']]}">
|
||||
<lion-radio name="gender[]" .choiceValue=${'male'}></lion-radio>
|
||||
<lion-radio name="gender[]" .choiceValue=${'female'}></lion-radio>
|
||||
</lion-radio-group>
|
||||
`);
|
||||
|
||||
await nextFrame();
|
||||
|
||||
expect(group.serializedValue).to.deep.equal('');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue