Skip to content

fix(input-number): restore decimal input mode default #9741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading