Skip to content

Commit

Permalink
test: add number widget comma test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellmueller committed May 9, 2024
1 parent 48bbd90 commit 9282658
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export const dummyDataUri =
"data:application/pdf;name=dummy.pdf;base64,ZHVtbXk=";
const mockFile = new File(["test"], "test.pdf", { type: "application/pdf" });

vi.resetAllMocks();

export const fileFieldSchema = {
type: "object",
required: ["fileTestField"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ describe("RJSF TextWidget", () => {
expect(input).toHaveValue(123);
});

it("should not allow entering commas in a number field", async () => {
render(<FormBase schema={numberFieldSchema} />);
const input = screen.getByLabelText(numberLabelRequired);

await userEvent.type(input, "1,000,000");
expect(input).toHaveValue(1000000);
});

it("should not allow entering numbers greater than the default max value", async () => {
render(<FormBase schema={numberFieldSchema} />);

Expand Down

0 comments on commit 9282658

Please sign in to comment.