Skip to content

Conversation

@Santi-3rd
Copy link
Contributor

@Santi-3rd Santi-3rd commented Jan 30, 2026

What changed

Added Cancel Modal for the Procurement Tracker Step 1

Issue

#1603 #4972

How to test

  • e2e tests pass
  • go to /agreements/13/procurement-tracker
  • fill out the form in Step 1
  • Click cancel
  • Modal should render. Cancel Edits should clear the form. Continue Edits and pressing the Esc key should exit the modal.

Screenshots

image

Definition of Done Checklist

  • OESA: Code refactored for clarity
  • OESA: Dependency rules followed
  • Automated unit tests updated and passed
  • Automated integration tests updated and passed
  • Automated quality tests updated and passed
  • Automated load tests updated and passed
  • Automated a11y tests updated and passed
  • Automated security tests updated and passed
  • 90%+ Code coverage achieved
  • [-] Form validations updated

@Santi-3rd Santi-3rd linked an issue Jan 30, 2026 that may be closed by this pull request
@Santi-3rd Santi-3rd marked this pull request as ready for review January 30, 2026 19:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a cancel confirmation modal to the Procurement Tracker Step 1 form. When users click the Cancel button after filling out the form, a modal prompts them to confirm whether they want to discard their changes or continue editing.

Changes:

  • Added cancel confirmation modal that prompts users before clearing form data
  • Renamed disableStep1Continue to disableStep1Buttons to reflect that both Cancel and Complete buttons share the same disabled state
  • Updated unit tests to cover modal functionality and removed redundant parent-level test
  • Added E2E test to verify complete cancel modal flow including modal appearance, dismissal, and form reset

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ProcurementTrackerStepOne.hooks.js Modified cancelStep1 to show confirmation modal instead of directly clearing form; added modal state management; renamed button disable variable
ProcurementTrackerStepOne.jsx Integrated ConfirmationModal component; applied disableStep1Buttons to Cancel button
ProcurementTrackerStepOne.hooks.test.js Updated tests to verify modal setup, modal confirmation behavior, and renamed variable
ProcurementTrackerStepOne.test.jsx Updated tests to use renamed disableStep1Buttons variable and added mock modal props
AgreementProcurementTracker.test.jsx Removed parent-level cancel test as functionality is now tested at component/hook level
procurementTracker.cy.js Added E2E test for cancel modal flow and updated existing test to verify cancel button disabled state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setStep1Notes("");
setShowModal(true);
setModalProps({
heading: "Are you sure you want to cancel this task? Your input will be not be saved.",
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

There's a spelling error in this modal heading. It should read "Your input will not be saved" instead of "Your input will be not be saved" (remove the extra "be").

Suggested change
heading: "Are you sure you want to cancel this task? Your input will be not be saved.",
heading: "Are you sure you want to cancel this task? Your input will not be saved.",

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +55
cy.get("#users-combobox-input").should("be.disabled");
cy.get("#date-completed").should("be.disabled");
cy.get("#notes").should("be.disabled");
cy.get('[data-cy="continue-btn"]').should("be.disabled");
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

This E2E test contains duplicate assertions. Lines 48-56 are exact duplicates of lines 52-56. The assertions for checking that form fields and buttons are disabled should only appear once. Remove lines 52-56.

Suggested change
cy.get("#users-combobox-input").should("be.disabled");
cy.get("#date-completed").should("be.disabled");
cy.get("#notes").should("be.disabled");
cy.get('[data-cy="continue-btn"]').should("be.disabled");

Copilot uses AI. Check for mistakes.
it("Cancel the form", () => {
cy.visit("/agreements/13/procurement-tracker");

//Fill out the form and then cancel the task
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

The comment "Fill out the form and then cancel the task" should use proper capitalization and punctuation. It should be "// Fill out the form and then cancel the task." with a capital F and a period at the end.

Suggested change
//Fill out the form and then cancel the task
// Fill out the form and then cancel the task.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@fpigeonjr fpigeonjr left a comment

Choose a reason for hiding this comment

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

👍 works as expected

};

const disableStep1Continue = !isPreSolicitationPackageSent || !selectedUser?.id || !step1DateCompleted;
const disableStep1Buttons = !isPreSolicitationPackageSent || !selectedUser?.id || !step1DateCompleted;
Copy link
Contributor

Choose a reason for hiding this comment

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

don't think we need to disable the cancel button if the form is not completed. should allow cancel at any time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought so too, but I double checked on Figma and it looked like both buttons are disabled and enabled together. Unless something changed that I don't know about.

heading: "Are you sure you want to cancel this task? Your input will be not be saved.",
actionButtonText: "Cancel Task",
secondaryButtonText: "Continue Editing",
handleConfirm: () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we have a cancel function in the hooks file you can use for the handleConfirm

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.

Cancel Modal

5 participants