Co-authored-by: Alex Ghiu <alex.ghiu@ing.com> Co-authored-by: Gerjan van Geest <Gerjan.van.Geest@ing.com> Co-authored-by: Thijs Louisse <Thijs.Louisse@ing.com> Co-authored-by: Joren Broekema <joren.broekema@ing.com> Co-authored-by: Erik Kroes <erik.kroes@ing.com>
28 lines
932 B
JavaScript
28 lines
932 B
JavaScript
import { expect, html, fixture, nextFrame } from '@open-wc/testing';
|
|
|
|
import { localizeTearDown } from '@lion/localize/test-helpers.js';
|
|
import { Required } from '@lion/validate';
|
|
|
|
import '@lion/checkbox/lion-checkbox.js';
|
|
import '../lion-checkbox-group.js';
|
|
|
|
beforeEach(() => {
|
|
localizeTearDown();
|
|
});
|
|
|
|
describe('<lion-checkbox-group>', () => {
|
|
it('can be required', async () => {
|
|
const el = await fixture(html`
|
|
<lion-checkbox-group .validators=${[new Required()]}>
|
|
<lion-checkbox name="sports[]" .choiceValue=${'running'}></lion-checkbox>
|
|
<lion-checkbox name="sports[]" .choiceValue=${'swimming'}></lion-checkbox>
|
|
</lion-checkbox-group>
|
|
`);
|
|
await nextFrame();
|
|
|
|
expect(el.hasFeedbackFor).to.deep.equal(['error']);
|
|
expect(el.validationStates.error.Required).to.be.true;
|
|
el.formElements['sports[]'][0].checked = true;
|
|
expect(el.hasFeedbackFor).to.deep.equal([]);
|
|
});
|
|
});
|