refactor(fe): убрать мёртвый repositionMenuAfterOpen - ядро внутреннее
Старый per-instance экспорт больше не используется (заменён глобальным installMenuRepositionFix). Старый тест-файл удалён - механизм покрыт installMenuRepositionFix.spec.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,16 +53,6 @@ function scheduleStabilize(): void {
|
||||
requestAnimationFrame(tick);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Ручной per-instance обход (привязывался к `@update:menu`).
|
||||
* Заменён глобальным {@link installMenuRepositionFix}. Оставлен временно,
|
||||
* до снятия ручных пометок в окнах.
|
||||
*/
|
||||
export function repositionMenuAfterOpen(open: boolean): void {
|
||||
if (!open) return;
|
||||
scheduleStabilize();
|
||||
}
|
||||
|
||||
let installed = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||
import { repositionMenuAfterOpen } from '../../resources/js/utils/menuRepositionFix';
|
||||
|
||||
/**
|
||||
* Unit-тесты воркэраунда Vuetify location-strategy (см. menuRepositionFix.ts).
|
||||
* Реальный баг — гонка позиционирования в браузере под prefers-reduced-motion —
|
||||
* в jsdom не воспроизводится (нет layout); он покрыт Playwright-пробой. Здесь
|
||||
* проверяется контракт утилиты: при стабилизации overlay-меню шлётся один resize.
|
||||
*/
|
||||
function makeStableMenu(left: number): HTMLElement {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'v-overlay v-menu';
|
||||
const content = document.createElement('div');
|
||||
content.className = 'v-overlay__content';
|
||||
content.getBoundingClientRect = () =>
|
||||
({
|
||||
width: 400,
|
||||
height: 300,
|
||||
left,
|
||||
top: 50,
|
||||
right: left + 400,
|
||||
bottom: 350,
|
||||
x: left,
|
||||
y: 50,
|
||||
toJSON() {},
|
||||
}) as DOMRect;
|
||||
overlay.appendChild(content);
|
||||
document.body.appendChild(overlay);
|
||||
return overlay;
|
||||
}
|
||||
|
||||
const wait = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
describe('repositionMenuAfterOpen', () => {
|
||||
afterEach(() => {
|
||||
document.querySelectorAll('.v-overlay').forEach((el) => el.remove());
|
||||
});
|
||||
|
||||
it('does nothing when menu is closing (open=false)', async () => {
|
||||
const spy = vi.fn();
|
||||
window.addEventListener('resize', spy);
|
||||
repositionMenuAfterOpen(false);
|
||||
await wait(200);
|
||||
window.removeEventListener('resize', spy);
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('dispatches a single resize once the overlay content is geometrically stable', async () => {
|
||||
makeStableMenu(120);
|
||||
const spy = vi.fn();
|
||||
window.addEventListener('resize', spy);
|
||||
repositionMenuAfterOpen(true);
|
||||
await wait(400);
|
||||
window.removeEventListener('resize', spy);
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not dispatch resize or throw when no overlay is present', async () => {
|
||||
const spy = vi.fn();
|
||||
window.addEventListener('resize', spy);
|
||||
expect(() => repositionMenuAfterOpen(true)).not.toThrow();
|
||||
await wait(300);
|
||||
window.removeEventListener('resize', spy);
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
# Brain Status (auto-generated)
|
||||
|
||||
Last updated: 2026-06-27T07:23:59.570Z
|
||||
Last updated: 2026-06-27T07:27:57.330Z
|
||||
|
||||
| Контролёр | Состояние | Детали |
|
||||
|---|---|---|
|
||||
@@ -132,8 +132,8 @@ Episodes since last run: 542 / threshold: 10
|
||||
|
||||
| PID | Имя | CPU-время | Возраст |
|
||||
|---|---|---|---|
|
||||
| 3440 | MsMpEng | 15.67ч | 0.0ч |
|
||||
| 21928 | Code | 5.83ч | 220523.4ч |
|
||||
| 3440 | MsMpEng | 15.67ч | NaNч |
|
||||
| 21928 | Code | 5.85ч | 10093714.0ч |
|
||||
| 1212 | svchost | 3.96ч | NaNч |
|
||||
|
||||
⚠️ Проверь, не «осиротевшие» ли это процессы от завершённых Claude-сессий.
|
||||
|
||||
Reference in New Issue
Block a user