QLFW-75: скобки подписи «необязательно» одним текстовым узлом, тест пробелов
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 3с
peppa/test test: success за 2с
peppa/build build: success за 52с
ci / checks (pull_request) Successful in 1m38s
deploy / deploy (pull_request) Successful in 2m33s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Peppa 2026-11-18 17:24:33 +05:00
parent 2968f785fc
commit 9ac1d19aec
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>`)
})
}
})