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

fix: survey doesn't get dismissed when response textarea is empty #18471

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions cypress/e2e/billingv2.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ describe('Billing', () => {
cy.visit('/organization/billing')
})

it('Show unsubscribe survey', () => {
it('Show and submit unsubscribe survey', () => {
cy.intercept('/api/billing-v2/deactivate?products=product_analytics', {
fixture: 'api/billing-v2/billing-v2-unsubscribed-product-analytics.json',
})
}).as('unsubscribeProductAnalytics')
cy.get('[data-attr=more-button]').first().click()
cy.contains('.LemonButton', 'Unsubscribe').click()
cy.get('.LemonModal__content h3').should(
Expand All @@ -17,7 +17,8 @@ describe('Billing', () => {
)
cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click()

cy.get('[data-attr=upgrade-card-product_analytics]').should('be.visible')
cy.get('.LemonModal').should('not.exist')
xrdt marked this conversation as resolved.
Show resolved Hide resolved
cy.wait(['@unsubscribeProductAnalytics'])
})

it('Unsubscribe survey text area maintains unique state between product types', () => {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T
type={textAreaNotEmpty ? 'primary' : 'tertiary'}
status={textAreaNotEmpty ? 'primary' : 'muted'}
onClick={() => {
textAreaNotEmpty && reportSurveySent(surveyID, surveyResponse)
textAreaNotEmpty
? reportSurveySent(surveyID, surveyResponse)
: reportSurveyDismissed(surveyID)
deactivateProduct(product.type)
}}
>
Expand Down
Loading