fix(checkbox-group): recover possibility to registrer without []

This commit is contained in:
Thijs Louisse 2021-04-13 00:31:17 +02:00
parent f2d9b8e232
commit b77a038d5f
3 changed files with 5 additions and 21 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/checkbox-group': patch
---
recover possibility to registrer without []

View file

@ -9,12 +9,4 @@ export class LionCheckboxGroup extends ChoiceGroupMixin(FormGroupMixin(LitElemen
super(); super();
this.multipleChoice = true; this.multipleChoice = true;
} }
/** @param {import('@lion/core').PropertyValues } changedProperties */
updated(changedProperties) {
super.updated(changedProperties);
if (changedProperties.has('name') && !String(this.name).match(/\[\]$/)) {
throw new Error('Names should end in "[]".');
}
}
} }

View file

@ -104,17 +104,4 @@ describe('<lion-checkbox-group>', () => {
`); `);
await expect(el).to.be.accessible(); await expect(el).to.be.accessible();
}); });
it("should throw exception if name doesn't end in []", async () => {
const el = await fixture(html`<lion-checkbox-group name="woof[]"></lion-checkbox-group>`);
el.name = 'woof';
let err;
try {
await el.updateComplete;
} catch (e) {
err = e;
}
expect(err).to.be.an.instanceof(Error);
expect(err.message).to.equal('Names should end in "[]".');
});
}); });