Skip to content

feat: add a character counter for fields with length limits #11558

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 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
🧪
  • Loading branch information
aslilac committed Jan 11, 2024
commit 01fe4660b71ffed80a4946ccbc293aecbb09bea8
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const fillAndSubmitForm = async ({
await userEvent.type(iconField, icon);

const allowCancelJobsField = screen.getByRole("checkbox", {
name: "Allow users to cancel in-progress workspace jobs. Depending on your template, canceling builds may leave workspaces in an unhealthy state. This option isn't recommended for most use cases.",
name: /allow users to cancel in-progress workspace jobs/i,
});
// checkbox is checked by default, so it must be clicked to get unchecked
if (!allow_user_cancel_workspace_jobs) {
Expand Down Expand Up @@ -123,8 +123,6 @@ describe("TemplateSettingsPage", () => {
"Nam quis nulla. Integer malesuada. In in enim a arcu imperdiet malesuada. Sed vel lectus. Donec odio urna, tempus molestie, port a",
};
const validate = () => getValidationSchema().validateSync(values);
expect(validate).toThrowError(
"Please enter a description that is less than or equal to 128 characters.",
);
expect(validate).toThrowError();
});
});
2 changes: 1 addition & 1 deletion site/src/utils/formUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe("form util functions", () => {
});

it("allows a 32-letter name", () => {
const input = "a".repeat(33);
const input = "a".repeat(32);
const validate = () => nameSchema.validateSync(input);
expect(validate).not.toThrow();
});
Expand Down