Skip to content

Commit 2740f17

Browse files
JaySunSynMikhail Bashkirov
authored andcommitted
fix(input): delegate "step" attribute
1 parent 22256ee commit 2740f17

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/input/src/LionInput.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ export class LionInput extends LionField {
2525
};
2626
}
2727

28+
get delegations() {
29+
return {
30+
...super.delegations,
31+
properties: [...super.delegations.properties, 'step'],
32+
attributes: [...super.delegations.attributes, 'step'],
33+
};
34+
}
35+
2836
get slots() {
2937
return {
3038
...super.slots,

packages/input/test/lion-input.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ describe('<lion-input>', () => {
1414
expect(el.inputElement.readOnly).to.equal(false);
1515
});
1616

17+
it('delegates "step" attribute and property', async () => {
18+
const el = await fixture(`<lion-input step="0.01"></lion-input>`);
19+
expect(el.inputElement.step).to.equal('0.01');
20+
// TODO: activate when DelegateMixin is refactored
21+
// const el2 = await fixture(`<lion-input .step="${'0.02'}"></lion-input>`);
22+
// expect(el2.inputElement.step).to.equal('0.02');
23+
});
24+
1725
it('automatically creates an <input> element if not provided by user', async () => {
1826
const el = await fixture(`<lion-input></lion-input>`);
1927
expect(el.querySelector('input')).to.equal(el.inputElement);

0 commit comments

Comments
 (0)