fix(input-amount): set hint to use numeric on-screen keyboard (#689)

This commit is contained in:
Davide 2020-04-17 17:49:14 +02:00 committed by GitHub
parent 0a03119bc4
commit 02778c0daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -82,6 +82,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) {
// eslint-disable-next-line wc/guard-super-call // eslint-disable-next-line wc/guard-super-call
super.connectedCallback(); super.connectedCallback();
this.type = 'text'; this.type = 'text';
this._inputNode.setAttribute('inputmode', 'decimal');
if (this.currency) { if (this.currency) {
this.__setCurrencyDisplayLabel(); this.__setCurrencyDisplayLabel();

View file

@ -64,6 +64,11 @@ describe('<lion-input-amount>', () => {
expect(el.parser).to.equal(parseAmount); expect(el.parser).to.equal(parseAmount);
}); });
it('sets inputmode attribute to decimal', async () => {
const el = await fixture(`<lion-input-amount></lion-input-amount>`);
expect(el._inputNode.inputMode).to.equal('decimal');
});
it('has type="text" to activate default keyboard on mobile with all necessary symbols', async () => { it('has type="text" to activate default keyboard on mobile with all necessary symbols', async () => {
const el = await fixture(`<lion-input-amount></lion-input-amount>`); const el = await fixture(`<lion-input-amount></lion-input-amount>`);
expect(el._inputNode.type).to.equal('text'); expect(el._inputNode.type).to.equal('text');