Skip to content

Commit

Permalink
Add type="tel" to Input
Browse files Browse the repository at this point in the history
  • Loading branch information
moroshko committed Mar 25, 2021
1 parent 7351f27 commit ee81d22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/Input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ describe("Input", () => {
expect(input).toHaveAttribute("type", "email");
});

it("type tel", () => {
render(<FormWithInput label="Mobile number" type="tel" />);

const input = screen.getByLabelText("Mobile number");

expect(input).toHaveAttribute("type", "tel");
});

it("numeric variant", () => {
render(<FormWithInput label="New credit limit" variant="numeric" />);

Expand Down
2 changes: 1 addition & 1 deletion src/components/internal/InternalInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useBackground from "../../hooks/useBackground";
import useResponsivePropsCSS from "../../hooks/useResponsivePropsCSS";
import { mergeProps } from "../../utils/component";

const TYPES = ["text", "password", "email"];
const TYPES = ["text", "password", "email", "tel"];
const VARIANTS = ["text", "numeric", "decimal"];
const COLORS = ["grey.t05", "white"];

Expand Down
6 changes: 6 additions & 0 deletions website/src/pages/components/input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ function InputPage() {
? "New credit limit"
: variant === "decimal"
? "Amount"
: type === "password"
? "Password"
: type === "email"
? "Email"
: type === "tel"
? "Mobile number"
: "Name",
},
{
Expand Down

0 comments on commit ee81d22

Please sign in to comment.