Merge pull request #180 from JaySunSyn/fix-input-step-attribute

[input] Delegate "step" attribute
This commit is contained in:
Mikhail Bashkirov 2019-07-16 18:17:10 +02:00 committed by GitHub
commit 1c2f7b0c8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);