PromucFlow_constructor/app/client/src/widgets/InputWidgetV2/widget/Utilities.test.ts
balajisoundar f1d1ee9ac0
fix: numeric type input widget should accept zero after decimal point (#11923)
- Derived properties of List widget children won't work. so having the text
  property of the Input widget as a derived property causes issues. hence
  having it as a meta property.
2022-03-18 22:18:16 +05:30

43 lines
1.0 KiB
TypeScript

import { InputTypes } from "widgets/BaseInputWidget/constants";
import { getParsedText } from "./Utilities";
describe("getParsedText", () => {
it("should test with all possible values", () => {
let text = getParsedText("test", InputTypes.TEXT);
expect(text).toBe("test");
text = getParsedText("test1", InputTypes.PASSWORD);
expect(text).toBe("test1");
text = getParsedText("test@appsmith.com", InputTypes.EMAIL);
expect(text).toBe("test@appsmith.com");
text = getParsedText("", InputTypes.NUMBER);
expect(text).toBe(null);
text = getParsedText((undefined as unknown) as string, InputTypes.NUMBER);
expect(text).toBe(null);
text = getParsedText((null as unknown) as string, InputTypes.NUMBER);
expect(text).toBe(null);
text = getParsedText((1 as unknown) as string, InputTypes.NUMBER);
expect(text).toBe(1);
text = getParsedText("1.01", InputTypes.NUMBER);
expect(text).toBe(1.01);
text = getParsedText("1.00", InputTypes.NUMBER);
expect(text).toBe(1);
});
});