QLFW-75: пробелы в подписях формы #56

Open
peppa-bot wants to merge 1 commits from task/qlfw-75 into main
2 changed files with 19 additions and 1 deletions

View File

@ -44,7 +44,7 @@ export function ContactForm({ t, locale, email, dark = false, privacyLink = fals
<input name="email" type="email" autoComplete="email" required maxLength={200} className={field} {...bad('email')} />
{err('email')}
</label>
<label className="block">{f.organization} <span className={hint}>({f.optional})</span>
<label className="block">{f.organization} <span className={hint}>{`(${f.optional})`}</span>
<input name="organization" type="text" autoComplete="organization" maxLength={200} className={field} />
</label>
<label className="block">{f.message}

View File

@ -0,0 +1,18 @@
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import { getDict, locales } from '@/i18n'
import { ContactForm } from './ContactForm'
vi.mock('@/app/actions/inquiry', () => ({ submitInquiry: vi.fn() }))
describe('Пробелы в подписях формы', () => {
for (const locale of locales) {
it(`Скобки без пробелов внутри, точка сразу после ссылки (${locale})`, () => {
const t = getDict(locale)
const html = renderToStaticMarkup(createElement(ContactForm, { t, locale, email: 'a@example.com', privacyLink: true }))
expect(html).toContain(`>(${t.form.optional})</span>`)
expect(html).toContain(`${t.form.consentPolicyLink}</a>${t.form.consentPolicyAfter}</span>`)
})
}
})