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

Make end of tour date optional #4476

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
5 changes: 3 additions & 2 deletions client/src/components/CustomDateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const CustomDateInput = ({
placeholder={inputFormat}
maxDate={maxDate}
minDate={moment().subtract(100, "years").startOf("year").toDate()}
canClearSelection={false}
canClearSelection
gjvoosten marked this conversation as resolved.
Show resolved Hide resolved
showActionsBar
closeOnSelection={!withTime}
timePickerProps={timePickerProps}
Expand All @@ -95,7 +95,8 @@ CustomDateInput.propTypes = {
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.instanceOf(Date)
PropTypes.instanceOf(Date),
PropTypes.oneOf([null])
gjvoosten marked this conversation as resolved.
Show resolved Hide resolved
]),
onChange: PropTypes.func,
onBlur: PropTypes.func
Expand Down
4 changes: 1 addition & 3 deletions client/src/models/Person.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ export default class Person extends Model {
if (Person.isPrincipal({ role })) {
return schema
} else {
schema = schema.required(
`You must provide the ${Settings.fields.person.endOfTourDate}`
)
// endOfTourDate is not required but if there is, it must be greater than today
if (Person.isPendingVerification({ pendingVerification })) {
schema = schema.test(
"end-of-tour-date",
Expand Down
18 changes: 1 addition & 17 deletions client/tests/webdriver/baseSpecs/createNewPerson.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe("Create new Person form page", () => {
)
// Don't logout, next test continues…
})
it("Should not save if endOfTourDate is not filled in", async() => {
it("Should save even if endOfTourDate is not filled in", async() => {
// Continue on the same page to prevent "Are you sure you wish to navigate away from the page" warning
await (
await CreatePerson.getLastName()
Expand All @@ -182,11 +182,6 @@ describe("Create new Person form page", () => {
await CreatePerson.getEmailAddress()
).setValue(VALID_PERSON_ADVISOR.emailAddress)
await (await CreatePerson.getLastName()).click()
gjvoosten marked this conversation as resolved.
Show resolved Hide resolved
let errorMessage = await browser.$(
"input#emailAddress + div.invalid-feedback"
)
// element should *not* be visible!
await errorMessage.waitForDisplayed({ timeout: 1000, reverse: true })
gjvoosten marked this conversation as resolved.
Show resolved Hide resolved
await (
await CreatePerson.getRank()
).selectByAttribute(
Expand All @@ -208,17 +203,6 @@ describe("Create new Person form page", () => {
// This makes sure the help-block is displayed after form submit
gjvoosten marked this conversation as resolved.
Show resolved Hide resolved
await (await CreatePerson.getEndOfTourDate()).setValue("")
await (await CreatePerson.getLastName()).click()
errorMessage = await (await CreatePerson.getEndOfTourDate())
.$("..")
.$("..")
.$("..")
.$("..")
.$("div.invalid-feedback")
await errorMessage.waitForExist()
await errorMessage.waitForDisplayed()
expect(await errorMessage.getText()).to.equal(
"You must provide the End of tour"
)
// Don't logout, next test continues…
})

Expand Down