Поправил шрифты и некоторые визуальные косяки

This commit is contained in:
dipatrik10
2026-09-27 17:47:36 +03:00
parent e3b6797713
commit c6083b35e0
37 changed files with 644 additions and 63 deletions

View File

@@ -81,6 +81,12 @@ test('Docker-образ включает локальный telemetry bundle и
assert.match(dockerfile, /scripts\/build-vendor\.mjs/);
assert.match(dockerfile, /COPY --from=frontend-assets \/build\/dist\/vendor\//);
assert.match(dockerfile, /magistr-security\.conf/);
for (const asset of ['ui-foundation.css', 'schedule-overview.css', 'schedule-overview.js']) {
const copiesAsset = dockerfile.split('\n').some(line =>
line.startsWith('COPY ') && line.includes(asset) && line.includes('/usr/local/apache2/htdocs/')
);
assert.ok(copiesAsset, `Общий ресурс отсутствует в Docker-образе: ${asset}`);
}
assert.match(telemetry, /import\('\/vendor\/otel\.js'\)/);
assert.doesNotMatch(telemetry, /https?:\/\//);
});

View File

@@ -0,0 +1,94 @@
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
const readFrontendFile = relativePath => readFile(
new URL(`../${relativePath}`, import.meta.url),
'utf8'
);
test('все пользовательские оболочки завершают каскад единой визуальной основой', async () => {
const entrypoints = [
['index.html', 'ui-foundation.css'],
['admin/index.html', '../ui-foundation.css'],
['admin/settings/index.html', '../../ui-foundation.css'],
['teacher/index.html', '../ui-foundation.css'],
['student/index.html', '../ui-foundation.css']
];
for (const [file, expectedHref] of entrypoints) {
const html = await readFrontendFile(file);
const stylesheets = Array.from(
html.matchAll(/<link\b[^>]*rel="stylesheet"[^>]*href="([^"]+)"[^>]*>/g),
match => match[1]
);
assert.equal(stylesheets.at(-1), expectedHref, file);
}
});
test('единая визуальная основа фиксирует типографику, размеры и доступный фокус', async () => {
const foundation = await readFrontendFile('ui-foundation.css');
assert.match(foundation, /--ui-font-sans:/);
assert.match(foundation, /--ui-control-sm:\s*32px/);
assert.match(foundation, /--ui-control-md:\s*40px/);
assert.match(foundation, /--ui-control-lg:\s*48px/);
assert.match(foundation, /\.btn-sm\s*\{[^}]*min-height:\s*var\(--ui-control-sm\)/s);
assert.match(foundation, /\.btn-md\s*\{[^}]*min-height:\s*var\(--ui-control-md\)/s);
assert.match(foundation, /\.btn-lg\s*\{[^}]*min-height:\s*var\(--ui-control-lg\)/s);
assert.match(foundation, /:focus-visible\s*\{[^}]*outline:/s);
assert.match(foundation, /prefers-reduced-motion:\s*reduce/);
});
test('локальные стили используют общие шрифтовые токены', async () => {
const files = [
'style.css',
'student/style.css',
'teacher/style.css',
'admin/css/main.css',
'admin/settings/css/main.css',
'admin/css/schedule-quality.css',
'admin/css/schedule-versions.css'
];
for (const file of files) {
const css = await readFrontendFile(file);
assert.doesNotMatch(css, /font-family:\s*(?:['"]?Inter|['"]?Segoe UI|Georgia|['"]Times New Roman)/, file);
}
});
test('архивные действия и кнопки закрытия используют системные размеры', async () => {
const actionSources = await Promise.all([
readFrontendFile('admin/js/views/classrooms.js'),
readFrontendFile('admin/js/views/groups.js'),
readFrontendFile('admin/js/views/users.js')
]);
actionSources.forEach(source => {
assert.match(source, /class="btn btn-sm btn-secondary btn-restore-/);
});
const modalViews = await Promise.all([
'admin/views/academic-calendar.html',
'admin/views/classrooms.html',
'admin/views/groups.html',
'admin/views/schedule.html',
'admin/views/schedule-versions.html',
'admin/views/subjects.html',
'admin/views/university-structure.html',
'admin/settings/views/time-slots.html'
].map(readFrontendFile));
const closeButtons = modalViews.flatMap(html => Array.from(
html.matchAll(/<button\b[^>]*class="[^"]*(?:modal-close|version-modal-close|settings-modal-close)[^"]*"[^>]*>/g),
match => match[0]
));
assert.ok(closeButtons.length > 0);
closeButtons.forEach(button => {
assert.match(button, /type="button"/);
assert.match(button, /class="[^"]*\bbtn\b[^"]*\bbtn-icon-md\b/);
assert.match(button, /aria-label="Закрыть окно"/);
});
});