Skip to content

Commit

Permalink
fix(input-number): restore decimal input mode default (#9741)
Browse files Browse the repository at this point in the history
**Related Issue:** #9740

## Summary

Restores `decimal` default for the internal input's `inputmode`, which
was unintentionally removed in
#9123.
  • Loading branch information
jcfranco authored Jul 11, 2024
1 parent 3319135 commit 9264011
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1818,4 +1818,34 @@ describe("calcite-input-number", () => {
expect(await input.getProperty("value")).toBe(`${totalNudgesUp}`);
expect(calciteInputNumberInput).toHaveReceivedEventTimes(totalNudgesUp);
});

it("should have decimal as initial inputmode", async () => {
const page = await newE2EPage();
await page.setContent(`<calcite-input-number></calcite-input-number>`);
const inputNumber = await page.find("calcite-input-number");
const internalInput = await page.find("calcite-input-number >>> input");

// we assert on the attribute as this is what browsers will look for to display the correct keyboard
expect(internalInput.getAttribute("inputmode")).toBe("decimal");

inputNumber.setProperty("inputMode", "text");
await page.waitForChanges();

expect(internalInput.getAttribute("inputmode")).toBe("text");

inputNumber.setProperty("inputMode", "");
await page.waitForChanges();

expect(internalInput.getAttribute("inputmode")).toBe("decimal");

inputNumber.setAttribute("inputmode", "none");
await page.waitForChanges();

expect(internalInput.getAttribute("inputmode")).toBe("none");

inputNumber.setAttribute("inputmode", "");
await page.waitForChanges();

expect(internalInput.getAttribute("inputmode")).toBe("decimal");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ export class InputNumber
defaultValue={this.defaultValue}
disabled={this.disabled ? true : null}
enterKeyHint={this.el.enterKeyHint || this.el.getAttribute("enterkeyhint")}
inputMode={this.el.inputMode || this.el.getAttribute("inputmode")}
inputMode={this.el.inputMode || this.el.getAttribute("inputmode") || "decimal"}
key="localized-input"
maxLength={this.maxLength}
minLength={this.minLength}
Expand Down

0 comments on commit 9264011

Please sign in to comment.