Skip to content

Commit

Permalink
fix: survey doesn't get dismissed when response textarea is empty (#1…
Browse files Browse the repository at this point in the history
…8471)

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

* address pr feedback

* fix logic nit

* fix up the logic...

---------

Co-authored-by: Bianca Yang <[email protected]>
  • Loading branch information
xrdt and Bianca Yang authored Nov 9, 2023
1 parent a9c22d3 commit 0521e2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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')
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

0 comments on commit 0521e2e

Please sign in to comment.