diff --git a/frontend/src/views/user/PaymentView.vue b/frontend/src/views/user/PaymentView.vue index 127e16e8e8..caad94ebc8 100644 --- a/frontend/src/views/user/PaymentView.vue +++ b/frontend/src/views/user/PaymentView.vue @@ -222,7 +222,7 @@ -

{{ checkout.help_text }}

+
@@ -258,6 +258,9 @@ ', + '', + '[Unsafe](javascript:alert%281%29)', + '[Support](https://example.com/help)', + ].join('\n\n')) + const help = wrapper.get('.markdown-body') + expect(help.find('script').exists()).toBe(false) + expect(help.get('img').attributes('onerror')).toBeUndefined() + expect(help.findAll('a').map(link => link.attributes('href'))).toEqual([undefined, 'https://example.com/help']) + }) + + it('keeps plain-text soft line breaks and the separate help image preview', async () => { + const wrapper = await mountHelp('First line\nSecond line', 'https://example.com/help.png') + const help = wrapper.get('.markdown-body') + expect(help.get('p').text()).toBe('First line\nSecond line') + expect(help.find('br').exists()).toBe(false) + await wrapper.get('img').trigger('click') + expect(wrapper.findAll('img')).toHaveLength(2) + expect(wrapper.findAll('img')[1].attributes('src')).toBe('https://example.com/help.png') + }) + + it('keeps image-only help without an empty Markdown container', async () => { + const wrapper = await mountHelp('', 'https://example.com/help.png') + expect(wrapper.find('.markdown-body').exists()).toBe(false) + expect(wrapper.get('img').attributes('src')).toBe('https://example.com/help.png') + }) +}) + describe('PaymentView subscription plan grid', () => { it.each([3, 4, 6])('keeps %i plans on the existing mobile/tablet/desktop grid', async (planCount) => { const wrapper = await mountSubscriptionPlanList(planCount)