-
Notifications
You must be signed in to change notification settings - Fork 148
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
fix: make callback on confirmation message instead #1845
fix: make callback on confirmation message instead #1845
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: -342 B (-0.01%) Total Size: 3.63 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR fixes a bug where feedback survey confirmation messages were closing prematurely by moving the survey reset functionality to trigger on confirmation message close instead of survey submission.
- Added new test in
src/__tests__/extensions/surveys/survey-popup.test.tsx
to verifyonCloseConfirmationMessage
callback behavior - Removed
onPopupSurveySent
fromSurveyContext
insrc/extensions/surveys/surveys-utils.tsx
in favor of confirmation message close handler - Added comprehensive end-to-end test in
playwright/surveys/feedback-widget.spec.ts
for multiple survey submissions with thank you messages - Improved accessibility in
BottomSection.tsx
andQuestionHeader.tsx
with proper ARIA attributes
7 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
previewPageIndex={mockSurvey.questions.length} | ||
/> | ||
) | ||
const cancelButton2 = screen.getByRole('button', { name: 'Close survey', hidden: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The button name 'Close survey' doesn't match the actual button text 'Close' defined in mockSurvey.appearance.thankYouMessageCloseButtonText
const cancelButton2 = screen.getByRole('button', { name: 'Close survey', hidden: true }) | |
const cancelButton2 = screen.getByRole('button', { name: mockSurvey.appearance.thankYouMessageCloseButtonText, hidden: true }) |
// Click the cancel button | ||
fireEvent.click(cancelButton2) | ||
// Verify that onCloseConfirmationMessage was called | ||
expect(mockOnCloseConfirmationMessage).toHaveBeenCalledTimes(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Should also verify mockRemoveSurveyFromFocus was called to ensure proper cleanup
@@ -31,6 +31,7 @@ export function BottomSection({ | |||
<button | |||
className="form-submit" | |||
disabled={submitDisabled} | |||
aria-label="Submit survey" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
className="form-cancel" | ||
onClick={onClick} | ||
disabled={isPreviewMode} | ||
aria-label="Close survey" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also missing
Changes
after I fix I did for this issue, it introduced a bug for feedback surveys where the confirmation message is not shown for feedback survey since it's being closed in the same instant.
so, this PR does two things:
reset
for the feedback widget popup happens when the survey is closedChecklist