fix(field): clear method reset modelValue
This commit is contained in:
parent
5103289f99
commit
cf13410026
2 changed files with 5 additions and 5 deletions
|
|
@ -162,7 +162,7 @@ export class LionField extends FormControlMixin(
|
|||
// invalid and dirty/touched states respectively
|
||||
super.clear();
|
||||
}
|
||||
this.value = ''; // can't set null here, because IE11 treats it as a string
|
||||
this.modelValue = ''; // can't set null here, because IE11 treats it as a string
|
||||
}
|
||||
|
||||
_onChange() {
|
||||
|
|
|
|||
|
|
@ -110,11 +110,11 @@ describe('<lion-field>', () => {
|
|||
it('can be cleared which erases value, validation and interaction states', async () => {
|
||||
const el = await fixture(html`<${tag} value="Some value from attribute">${inputSlot}</${tag}>`);
|
||||
el.clear();
|
||||
expect(el.value).to.equal('');
|
||||
el.value = 'Some value from property';
|
||||
expect(el.value).to.equal('Some value from property');
|
||||
expect(el.modelValue).to.equal('');
|
||||
el.modelValue = 'Some value from property';
|
||||
expect(el.modelValue).to.equal('Some value from property');
|
||||
el.clear();
|
||||
expect(el.value).to.equal('');
|
||||
expect(el.modelValue).to.equal('');
|
||||
});
|
||||
|
||||
it('can be reset which restores original modelValue', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue