diff --git a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts index 05c0e573cb7..528b97b2e02 100644 --- a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts +++ b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts @@ -398,17 +398,25 @@ describe('SubscriptionAddPaymentPreviewWorkspace', () => { expect(screen.getByText('op-reconcile-123')).toBeTruthy() }) - it('does not render a back action on the payment confirmation', () => { - render(SubscriptionAddPaymentPreviewWorkspace, { - props: { tierKey: 'creator', isLoading: true }, - global: globalOptions + it('owns a back action whether or not the payment element is embedded', async () => { + const { emitted } = render(SubscriptionAddPaymentPreviewWorkspace, { + props: { tierKey: 'creator' }, + global: { + ...globalOptions, + stubs: { + ...globalOptions.stubs, + Button: { + props: ['ariaLabel'], + template: + '' + } + } + } }) - expect( - screen.queryByRole('button', { - name: 'subscription.preview.backToAllPlans' - }) - ).toBeNull() + await userEvent.click(screen.getByRole('button', { name: 'g.back' })) + + expect(emitted().back).toBeTruthy() }) it('prices a legacy preview from the server costs instead of rendering a blank total', () => { diff --git a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue index 24acd5eb452..e82bb75cb06 100644 --- a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue +++ b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue @@ -27,7 +27,6 @@ :class="cn('mb-8 flex items-center gap-3', captureMode && 'xl:mb-10')" > + ` }, SubscriptionTransitionPreviewWorkspace: { template: '
' }, @@ -248,4 +250,22 @@ describe('SubscriptionRequiredDialogContentUnified team-plan subscribe', () => { }) expect(mockHandleSubscribeClick).not.toHaveBeenCalled() }) + + it.for([true, false])( + 'leaves the confirm step its own header and back action (embedded: %s)', + async (embeddedCheckoutEnabled) => { + mockCheckoutStep.value = 'preview' + mockPreviewVariant.value = 'team-new' + mockSelectedTeamStop.value = TEAM_PAYLOAD.stop + + renderComponent({ embeddedCheckoutEnabled }) + + expect(screen.queryByText('Choose your plan')).toBeNull() + expect(screen.getAllByRole('button', { name: 'Back' })).toHaveLength(1) + + await userEvent.click(screen.getByRole('button', { name: 'Back' })) + + expect(mockHandleBackToPricing).toHaveBeenCalled() + } + ) }) diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue b/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue index bb75978af34..77d8fbc2d2d 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue @@ -28,22 +28,6 @@ ) " > - - - +

diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts index a11b43911bf..5ab17c57843 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts @@ -63,6 +63,7 @@ const AddPaymentPreviewStub = { +

` } @@ -209,11 +210,11 @@ describe('SubscriptionRequiredDialogContentWorkspace', () => { expect(onClose).toHaveBeenCalledOnce() }) - it('shows back button on preview step', () => { + it('leaves the back action to the preview step that renders its own', () => { mockCheckoutStep.value = 'preview' mockPreviewData.value = { transition_type: 'new_subscription' } renderComponent() - expect(screen.getByLabelText('Back')).toBeInTheDocument() + expect(screen.getAllByRole('button', { name: 'Back' })).toHaveLength(1) }) it('shows insufficient credits message when reason is out_of_credits', () => { @@ -283,7 +284,7 @@ describe('SubscriptionRequiredDialogContentWorkspace', () => { mockPreviewData.value = { transition_type: 'new_subscription' } renderComponent() - await user.click(screen.getByLabelText('Back')) + await user.click(screen.getByRole('button', { name: 'Back' })) expect(mockHandleBackToPricing).toHaveBeenCalled() }) diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue index 9be5f65c6af..770cd410d32 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue @@ -2,18 +2,6 @@
- -