Record slice 1 recheck after clothing, session and social.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 14:33:30 +03:00
co-authored by Cursor
parent a5aa1a7f74
commit f6bb4c76cc
4 changed files with 169 additions and 1 deletions
@@ -98,6 +98,82 @@ describe('GameScreen speed buttons', () => {
});
});
describe('GameScreen location tree', () => {
it('filters the location panel on the client when a tree node is clicked', () => {
const screen = new GameScreen({
onLeave: () => {},
onSetRunning: () => {},
onSetSpeed: () => {},
onSkip: () => {},
});
document.body.append(screen.element);
screen.show(school());
screen.applyMap(1, [
{
kind: 0,
id: 'yard',
parentId: '',
name: 'Двор',
pupilSlots: 0,
items: [],
positions: [],
},
{
kind: 3,
id: 'office',
parentId: 'yard',
name: 'Кабинет',
pupilSlots: 0,
items: [{ name: 'Стул', count: 2 }],
positions: ['Директор'],
},
]);
expect(screen.element.querySelector('.panel__name')?.textContent).toBe('Двор');
const itemsSection = screen.element.querySelector('.panel__section');
expect(itemsSection?.querySelector('.panel__empty')?.textContent).toBe(t('itemsEmpty'));
const office = [...screen.element.querySelectorAll<HTMLButtonElement>('.tree__button')].find(
(button) => button.textContent === 'Кабинет',
);
expect(office).toBeTruthy();
office?.click();
expect(screen.element.querySelector('.panel__name')?.textContent).toBe('Кабинет');
expect(office?.classList.contains('tree__button--active')).toBe(true);
const lists = [...screen.element.querySelectorAll('.panel__section .panel__list')].map(
(list) => [...list.querySelectorAll('li')].map((item) => item.textContent ?? ''),
);
expect(lists.some((entries) => entries.includes('Стул ×2'))).toBe(true);
expect(lists.some((entries) => entries.includes('Директор'))).toBe(true);
});
it('relocalizes empty location sections when the language switches', () => {
setLocale('en');
const screen = new GameScreen({
onLeave: () => {},
onSetRunning: () => {},
onSetSpeed: () => {},
onSkip: () => {},
});
document.body.append(screen.element);
screen.show(school());
expect(screen.element.querySelector('.panel__section-title')?.textContent).toBe(t('locationItems'));
expect([...screen.element.querySelectorAll('.panel__empty')].map((node) => node.textContent)).toContain(
t('itemsEmpty'),
);
setLocale('ru');
screen.localize();
expect(screen.element.querySelector('.panel__section-title')?.textContent).toBe(t('locationItems'));
expect([...screen.element.querySelectorAll('.panel__empty')].map((node) => node.textContent)).toContain(
t('itemsEmpty'),
);
});
});
describe('GameScreen location talk', () => {
it('shows talk partners from the directory on the location list, not from the frame', () => {
setLocale('ru');