Skip to content
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

test: Outstanding List component validation tests #3323

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Jun 26, 2024

What does this PR do?

@DafyddLlyr DafyddLlyr changed the title test: Outstanding List component validation testss test: Outstanding List component validation tests Jun 26, 2024
Copy link

github-actions bot commented Jun 26, 2024

Removed vultr server and associated DNS entries

@@ -16,6 +15,7 @@ import { DESCRIPTION_TEXT, ERROR_MESSAGE } from "../../shared/constants";
import BasicRadio from "../../shared/Radio/BasicRadio";
import type { NumberField, QuestionField, TextField } from "../model";
import { useListContext } from "./Context";
import { get } from "lodash";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was required as the formik's getIn() doesn't correctly handle fn fields using dot notation (e.g. proposal.propertyType).

Docs: https://formik.org/docs/api/fieldarray#fieldarray-validation-gotchas

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡

@DafyddLlyr DafyddLlyr force-pushed the dp/list-todo-validation-tests branch from bfc8f5a to 4f6287a Compare June 27, 2024 17:16
Comment on lines +87 to +90
// Do not allow new item to be added if it will exceed max
if (schema.max && formik.values.userData.length === schema.max) {
return setMaxError(true);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this here feels like a better user experience than just checking this when a user hits "Continue" (and may have added too many items).

@DafyddLlyr DafyddLlyr requested a review from a team June 27, 2024 17:19
@DafyddLlyr DafyddLlyr marked this pull request as ready for review June 27, 2024 17:19
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaningful coverage here 💯

@DafyddLlyr DafyddLlyr force-pushed the dp/list-todo-validation-tests branch from 4f6287a to 6d75bb7 Compare June 28, 2024 10:14
@DafyddLlyr DafyddLlyr force-pushed the dp/list-todo-validation-tests branch from 6d75bb7 to 770d301 Compare June 28, 2024 10:28
@DafyddLlyr DafyddLlyr merged commit 766e7b2 into main Jun 28, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/list-todo-validation-tests branch June 28, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants