diff --git a/src/components/TextField/TextFieldConstants.ts b/src/components/TextField/TextFieldConstants.ts index 4f60e3a307..7b8c41bc8c 100644 --- a/src/components/TextField/TextFieldConstants.ts +++ b/src/components/TextField/TextFieldConstants.ts @@ -29,6 +29,7 @@ export enum TextFieldTextType { DATE = "date", DATE_TIME = "datetime-local", NUMBER = "number", + URL = "url", EMAIL = "email" } diff --git a/src/components/TextField/__tests__/TextField.jest.js b/src/components/TextField/__tests__/TextField.jest.js index a243cf54de..3471eb3aaf 100644 --- a/src/components/TextField/__tests__/TextField.jest.js +++ b/src/components/TextField/__tests__/TextField.jest.js @@ -227,6 +227,17 @@ describe("TextField Tests", () => { expect(input.type).toBe(TextField.types.PASSWORD); }); + it("type should be url", () => { + const { rerender } = inputComponent; + act(() => { + inputComponent = rerender( + + ); + }); + const input = screen.getByPlaceholderText(defaultPlaceHolder); + expect(input.type).toBe(TextField.types.URL); + }); + it("type should be email", () => { const { rerender } = inputComponent; act(() => { diff --git a/src/components/TextField/__tests__/__snapshots__/textField-snapshot-tests.jest.js.snap b/src/components/TextField/__tests__/__snapshots__/textField-snapshot-tests.jest.js.snap index fc01968220..3fdb3bcf9a 100644 --- a/src/components/TextField/__tests__/__snapshots__/textField-snapshot-tests.jest.js.snap +++ b/src/components/TextField/__tests__/__snapshots__/textField-snapshot-tests.jest.js.snap @@ -1236,6 +1236,68 @@ exports[`TextField renders correctly with showCharCount 1`] = ` `; +exports[`TextField renders correctly with url type 1`] = ` +
+
+
+ +
+
+
+
+
+`; + exports[`TextField renders correctly with validation 1`] = `
{ expect(tree).toMatchSnapshot(); }); + it("with url type", () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); + it("with email type", () => { const tree = renderer.create().toJSON(); expect(tree).toMatchSnapshot();