fix(input): delegate "step" attribute

This commit is contained in:
JaySunSyn 2019-07-16 13:41:07 +02:00 committed by Mikhail Bashkirov
parent 22256eed84
commit 2740f17605
2 changed files with 16 additions and 0 deletions

View file

@ -25,6 +25,14 @@ export class LionInput extends LionField {
}; };
} }
get delegations() {
return {
...super.delegations,
properties: [...super.delegations.properties, 'step'],
attributes: [...super.delegations.attributes, 'step'],
};
}
get slots() { get slots() {
return { return {
...super.slots, ...super.slots,

View file

@ -14,6 +14,14 @@ describe('<lion-input>', () => {
expect(el.inputElement.readOnly).to.equal(false); expect(el.inputElement.readOnly).to.equal(false);
}); });
it('delegates "step" attribute and property', async () => {
const el = await fixture(`<lion-input step="0.01"></lion-input>`);
expect(el.inputElement.step).to.equal('0.01');
// TODO: activate when DelegateMixin is refactored
// const el2 = await fixture(`<lion-input .step="${'0.02'}"></lion-input>`);
// expect(el2.inputElement.step).to.equal('0.02');
});
it('automatically creates an <input> element if not provided by user', async () => { it('automatically creates an <input> element if not provided by user', async () => {
const el = await fixture(`<lion-input></lion-input>`); const el = await fixture(`<lion-input></lion-input>`);
expect(el.querySelector('input')).to.equal(el.inputElement); expect(el.querySelector('input')).to.equal(el.inputElement);