fix(checkbox-group): recover possibility to registrer without []
This commit is contained in:
parent
f2d9b8e232
commit
b77a038d5f
3 changed files with 5 additions and 21 deletions
5
.changeset/lemon-shoes-doubt.md
Normal file
5
.changeset/lemon-shoes-doubt.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@lion/checkbox-group': patch
|
||||
---
|
||||
|
||||
recover possibility to registrer without []
|
||||
|
|
@ -9,12 +9,4 @@ export class LionCheckboxGroup extends ChoiceGroupMixin(FormGroupMixin(LitElemen
|
|||
super();
|
||||
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 "[]".');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,17 +104,4 @@ describe('<lion-checkbox-group>', () => {
|
|||
`);
|
||||
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 "[]".');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue