qazaq-legacy-foundation-web/src/components/header.test.ts
Peppa 8d9de24d2f
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 3с
peppa/test test: success за 1с
peppa/build build: success за 45с
ci / checks (pull_request) Successful in 1m20s
deploy / deploy (pull_request) Successful in 1m50s
QLFW-41: текущий язык в переключателе — заметная плашка
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:35:51 +05:00

20 lines
894 B
TypeScript

import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it } from 'vitest'
import { getDict, locales } from '@/i18n'
import { Header } from './Header'
describe('Сценарий: текущий язык в переключателе заметно выделен', () => {
it.each(locales)('на языке %s выделен только текущий язык', (locale) => {
const html = renderToStaticMarkup(
createElement(Header, { t: getDict(locale), locale, showProjects: true, showNews: true }),
)
const links = [...html.matchAll(/<a [^>]*hrefLang="(\w+)"[^>]*class="([^"]*)"/g)]
expect(links).toHaveLength(locales.length)
for (const [, l, cls] of links) {
if (l === locale) expect(cls).toContain('bg-burgundy font-bold')
else expect(cls).toContain('text-graphite')
}
})
})