import { expect, fixture, html } from '@open-wc/testing'; import '../lion-checkbox.js'; /** * @typedef {import('../src/LionCheckbox').LionCheckbox} LionCheckbox */ describe('', () => { it('should have type = checkbox', async () => { const el = await fixture(html` `); expect(el.getAttribute('type')).to.equal('checkbox'); }); it('can be reset when unchecked by default', async () => { const el = /** @type {LionCheckbox} */ (await fixture(html` `)); expect(el._initialModelValue).to.deep.equal({ value: 'male', checked: false }); el.checked = true; expect(el.modelValue).to.deep.equal({ value: 'male', checked: true }); el.reset(); expect(el.modelValue).to.deep.equal({ value: 'male', checked: false }); }); it('can be reset when checked by default', async () => { const el = /** @type {LionCheckbox} */ (await fixture(html` `)); expect(el._initialModelValue).to.deep.equal({ value: 'male', checked: true }); el.checked = false; expect(el.modelValue).to.deep.equal({ value: 'male', checked: false }); el.reset(); expect(el.modelValue).to.deep.equal({ value: 'male', checked: true }); }); });