验证20%

This commit is contained in:
rain
2026-07-31 11:31:26 +08:00
parent 309598bfa6
commit ac5823547a
24 changed files with 751 additions and 279 deletions
+36
View File
@@ -0,0 +1,36 @@
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const test = require('node:test');
const root = path.join(__dirname, '..');
function read(file) {
return fs.readFileSync(path.join(root, file), 'utf8');
}
test('profile navigation has a medium-desktop compact mode and no mobile duplicate sidebar', () => {
const publicCss = read('public/css/public.css');
const moduleCss = read('public/css/profile-module.css');
assert.match(
publicCss,
/@media \(max-width: 1320px\) \{[\s\S]*?\.page-profile \.nav-links,[\s\S]*?\.page-profile-module \.nav-links \{\s*display: none;/
);
assert.match(
moduleCss,
/@media \(max-width: 720px\) \{[\s\S]*?\.page-profile-module \.module-nav \{\s*display: none;/
);
});
test('my genealogies keeps one primary create action and the compact menu marks the current page', () => {
const page = read('profile-families.html');
const header = page.slice(0, page.indexOf('</header>'));
const common = read('public/js/profile-common.js');
const publicCss = read('public/css/public.css');
assert.doesNotMatch(header, /href="profile-create-family\.html"/);
assert.match(page, /module-title-row[\s\S]*?href="profile-create-family\.html"/);
assert.match(common, /addClass\('is-current'\)\.attr\('aria-current', 'page'\)/);
assert.match(publicCss, /\.profile-mobile-menu a\.is-current/);
});