Record slice 2 recheck after notices and portraits.

This commit is contained in:
Leonid Pershin
2026-08-21 03:08:40 +03:00
parent c3d17cafc6
commit 2a199fda8f
4 changed files with 100 additions and 1 deletions
@@ -151,6 +151,41 @@ describe('renderPersonCard', () => {
expect(root.querySelector('[data-card-tab="now"]')?.hasAttribute('hidden')).toBe(false);
});
it('opens a relative from the overview family links', () => {
setLocale('ru');
const onRelative = vi.fn();
const root = document.createElement('div');
renderPersonCard(
root,
card({
skills: [{ id: 'Mathematics', label: 'Математика', value: '62' }],
traits: [{ defName: 'Diligent', label: 'Усидчивый' }],
needs: [{ id: 'Sleep', label: 'Сон', value: 1 }],
family: {
parents: [{ id: 'f0.p0', fullName: 'Иванова Ольга', female: true }],
children: [],
siblings: [],
partners: [],
},
}),
onRelative,
options(),
);
const overview = root.querySelector('[data-card-tab="overview"]');
expect(overview?.textContent).toContain('Рост');
expect(overview?.textContent).toContain('Математика');
expect(overview?.textContent).toContain('Усидчивый');
expect(overview?.textContent).toContain('Сон');
expect(overview?.textContent).toContain(t('peopleParents'));
const mother = overview?.querySelector('.people__link');
expect(mother).toBeInstanceOf(HTMLButtonElement);
expect(mother?.textContent).toBe('Иванова Ольга');
(mother as HTMLButtonElement).click();
expect(onRelative).toHaveBeenCalledWith('f0.p0');
});
it('shows the server condition caption, not a band inferred from the number', () => {
setLocale('ru');
const root = document.createElement('div');