mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-17 01:07:56 +00:00
fix(billing): cancelled team sub on a different stop reads Change plan, not Resubscribe (FE-934)
This commit is contained in:
@@ -170,6 +170,26 @@ describe('UnifiedPricingTable team plan CTA', () => {
|
||||
expect(emitted().resubscribe).toBeTruthy()
|
||||
})
|
||||
|
||||
it('changes plan (not re-subscribe) when a cancelled sub picks a different stop', async () => {
|
||||
const user = userEvent.setup()
|
||||
mockSubscription.value = {
|
||||
tier: 'TEAM',
|
||||
duration: 'ANNUAL',
|
||||
isCancelled: true
|
||||
}
|
||||
mockCurrentTeamCreditStop.value = TEAM_STOP
|
||||
|
||||
const { emitted } = renderComponent({ initialPlanMode: 'team' })
|
||||
|
||||
await user.click(screen.getByTestId('team-slider'))
|
||||
|
||||
const cta = screen.getByRole('button', { name: 'Change plan' })
|
||||
expect(cta).toBeEnabled()
|
||||
await user.click(cta)
|
||||
expect(emitted().subscribeTeam).toBeTruthy()
|
||||
expect(emitted().resubscribe).toBeFalsy()
|
||||
})
|
||||
|
||||
it('prompts a fresh subscribe when on no team plan', () => {
|
||||
renderComponent({ initialPlanMode: 'team' })
|
||||
|
||||
|
||||
@@ -684,9 +684,13 @@ const teamButtonLabel = computed(() => {
|
||||
? t('subscription.teamPlan.cta')
|
||||
: t('subscription.teamPlan.ctaMonthly')
|
||||
}
|
||||
if (isCancelled.value) return t('subscription.resubscribe')
|
||||
if (isTeamCurrentStopSelected.value)
|
||||
return t('subscription.teamPlan.currentPlan')
|
||||
// Only the current stop re-subscribes (cancelled) or reads "Current plan"
|
||||
// (active); any other stop is a plan change.
|
||||
if (isTeamCurrentStopSelected.value) {
|
||||
return isCancelled.value
|
||||
? t('subscription.resubscribe')
|
||||
: t('subscription.teamPlan.currentPlan')
|
||||
}
|
||||
return t('subscription.teamPlan.changePlan')
|
||||
})
|
||||
|
||||
@@ -811,7 +815,8 @@ function handleSubscribe(tierKey: CheckoutTierKey) {
|
||||
|
||||
function handleSubscribeTeam() {
|
||||
if (isTeamButtonDisabled.value) return
|
||||
if (isTeamSubscribed.value && isCancelled.value) {
|
||||
// Re-subscribe only when keeping the current stop; a different stop is a change.
|
||||
if (isCancelled.value && isTeamCurrentStopSelected.value) {
|
||||
emit('resubscribe')
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user