Files
DndGamePlayer/app/renderer/shared/tokens/tokenPathLiveDom.test.ts
T
Ivan Fontosh fdccc0deb5 fix(tokens): импорт неигровых токенов из zip и плавные пути на macOS
Полный импорт/открытие проекта подхватывает app-tokens. Движение по путям пишется в DOM без ре-рендера кадра, у пульта и презентации выключен background throttling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:16:30 +08:00

17 lines
807 B
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { writeTokenPathTransform } from './tokenPathLiveDom';
void test('writeTokenPathTransform: GPU-friendly translate3d, not left/top', () => {
const el = { style: { transform: '' } } as unknown as HTMLElement;
writeTokenPathTransform(el, 0.25, 0.5, 45, { x: 10, y: 20, w: 200, h: 100 }, true);
assert.equal(el.style.transform, 'translate3d(60px, 70px, 0) translate(-50%, -50%) rotate(45deg)');
});
void test('writeTokenPathTransform: NPC without rotate keeps centering only', () => {
const el = { style: { transform: '' } } as unknown as HTMLElement;
writeTokenPathTransform(el, 0, 0, 90, { x: 0, y: 0, w: 100, h: 100 }, false);
assert.equal(el.style.transform, 'translate3d(0px, 0px, 0) translate(-50%, -50%)');
});