Commit cc32d425 authored by Kev's avatar Kev Committed by Vitaly Slobodin

Hide "Renew" button for trial subscription on group billing page

parent 2b932374
......@@ -50,6 +50,9 @@ export default {
return `${this.namespaceName}: ${planName} ${suffix}`;
},
canRenew() {
return this.isSubscription && !this.plan.trial;
},
canUpgrade() {
return this.isFreePlan || this.plan.upgradable;
},
......@@ -78,7 +81,7 @@ export default {
return this.canUpgradeEEPlan ? this.planUpgradeHref : this.customerPortalUrl;
},
renewButton() {
return this.isSubscription
return this.canRenew
? createButtonProps(s__('SubscriptionTable|Renew'), this.planRenewHref, 'renew-button')
: null;
},
......
---
title: Hide "Renew" button for trial subscription on group billing page
merge_request: 55796
author: Kev @KevSlashNull
type: fixed
......@@ -132,19 +132,21 @@ describe('SubscriptionTable component', () => {
describe('Renew button', () => {
describe.each`
planCode | expected | testDescription
${'silver'} | ${true} | ${'renders the button'}
${null} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${'does not render the button'}
planCode | trial | expected | testDescription
${'silver'} | ${false} | ${true} | ${'renders the button'}
${'silver'} | ${true} | ${false} | ${'does not render the button'}
${null} | ${false} | ${false} | ${'does not render the button'}
${'free'} | ${false} | ${false} | ${'does not render the button'}
`(
'given a plan with state: planCode = $planCode',
({ planCode, expected, testDescription }) => {
'given a plan with state: planCode = $planCode, trial = $trial',
({ planCode, trial, expected, testDescription }) => {
beforeEach(() => {
createComponentWithStore({
state: {
isLoadingSubscription: false,
plan: {
code: planCode,
trial,
},
},
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment