修复(充值弹层): 任一商品提交中即禁用会员结算
- 会员结算 canSubmit 由 !submitting 改为 !submittingProductId,与充点分支的 ctaDisabled 口径一致 - 避免充点在途时仍能提交会员结算、被 buyRechargeProduct 静默丢弃后直接关闭弹层 - 补充反向用例:泥点订单提交中时会员结算按钮禁用
This commit is contained in:
@@ -530,6 +530,50 @@ describe('PlatformProfileRechargeModal', () => {
|
||||
).toHaveProperty('disabled', true);
|
||||
});
|
||||
|
||||
test('泥点订单提交中时会员结算入口禁用', async () => {
|
||||
const user = userEvent.setup();
|
||||
const renderModal = (submittingProductId: string | null) => (
|
||||
<PlatformProfileRechargeModal
|
||||
center={{
|
||||
mudPointBalance: buildMudPointBalance(29),
|
||||
membership: buildNormalMembership(),
|
||||
pointProducts: buildPointProducts(),
|
||||
membershipPlans: [STARTER_PLAN],
|
||||
latestOrder: null,
|
||||
hasPointsRecharged: false,
|
||||
}}
|
||||
isLoading={false}
|
||||
error={null}
|
||||
submittingProductId={submittingProductId}
|
||||
nativePayment={null}
|
||||
membershipQuote={null}
|
||||
isLoadingMembershipQuote={false}
|
||||
membershipQuoteError={null}
|
||||
onClose={vi.fn()}
|
||||
onRetry={vi.fn()}
|
||||
onBuy={vi.fn()}
|
||||
onRequestMembershipQuote={vi.fn()}
|
||||
onSubmitMembershipCheckout={vi.fn()}
|
||||
onConfirmNativePayment={vi.fn()}
|
||||
onCloseNativePayment={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
const { rerender } = render(renderModal(null));
|
||||
await user.click(
|
||||
screen.getByRole('button', { name: 'Starter 月付 开通会员' }),
|
||||
);
|
||||
|
||||
// 泥点订单提交中:会员结算 CTA 同样禁用,避免宿主守卫静默丢弃提交后直接关弹层。
|
||||
rerender(renderModal('points_60'));
|
||||
expect(
|
||||
within(screen.getByRole('dialog', { name: '确认订单' })).getByRole(
|
||||
'button',
|
||||
{ name: '支付 ¥39' },
|
||||
),
|
||||
).toHaveProperty('disabled', true);
|
||||
});
|
||||
|
||||
test('shows the empty state when the recharge tab has no point product', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
|
||||
@@ -1074,7 +1074,8 @@ function PlatformRechargeCheckoutDialog({
|
||||
}
|
||||
const canSubmit =
|
||||
Boolean(plan) &&
|
||||
!submitting &&
|
||||
// 与充点分支一致:任一商品在途都禁用提交,避免静默无操作后直接关弹层。
|
||||
!submittingProductId &&
|
||||
(!isUpgrade || Boolean(quoteForTarget)) &&
|
||||
amountCents > 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user