Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

25 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { rectsEqual, type LayoutRect } from '@/components/scene-renderers/pbl/v2/host-rect';
const base: LayoutRect = { left: 100, top: 50, width: 800, height: 450 };
describe('PBL v2 — rectsEqual (docked host-rect dirty-check)', () => {
it('is true for identical rects (idle frame → no re-render)', () => {
expect(rectsEqual(base, { ...base })).toBe(true);
});
it('detects a position-only shift (the side-panel re-center bug)', () => {
// The 16:9 host box is height-constrained, so toggling a side panel moves
// it horizontally without resizing it. This must be seen as a change so the
// docked frame follows instead of leaking the box beside it.
expect(rectsEqual(base, { ...base, left: 240 })).toBe(false);
expect(rectsEqual(base, { ...base, top: 70 })).toBe(false);
});
it('detects a size change', () => {
expect(rectsEqual(base, { ...base, width: 900 })).toBe(false);
expect(rectsEqual(base, { ...base, height: 506 })).toBe(false);
});
});