feat: улучшить учебные периоды и просмотр расписаний
This commit is contained in:
1 parent
855d191517
commit
52d516dd8f
22 files changed
+1107
-250
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
|
||||
import { calculateVisualContextMenuPosition } from '../admin/js/views/schedule.js';
|
||||
|
||||
test('меню пары открывается справа от кнопки с тремя точками', () => {
|
||||
assert.deepEqual(calculateVisualContextMenuPosition({
|
||||
anchorRect: { left: 100, right: 120, top: 80, bottom: 100 },
|
||||
menuWidth: 220,
|
||||
menuHeight: 120,
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 720
|
||||
}), { left: 128, top: 80 });
|
||||
});
|
||||
|
||||
test('у края экрана меню раскрывается влево и остаётся в viewport', () => {
|
||||
assert.deepEqual(calculateVisualContextMenuPosition({
|
||||
anchorRect: { left: 1240, right: 1260, top: 680, bottom: 700 },
|
||||
menuWidth: 220,
|
||||
menuHeight: 160,
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 720
|
||||
}), { left: 1012, top: 540 });
|
||||
});
|
||||
|
||||
test('контекстное меню больше не центрируется стилями', async () => {
|
||||
const styles = await readFile(new URL('../admin/css/components.css', import.meta.url), 'utf8');
|
||||
const menuRule = styles.match(/\.schedule-visual-context-menu\s*\{([\s\S]*?)\}/)?.[1] || '';
|
||||
|
||||
assert.doesNotMatch(menuRule, /translate\(-50%,\s*-50%\)/);
|
||||
assert.match(menuRule, /position:\s*fixed/);
|
||||
});
|
||||
Reference in new issue
Block a user