37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
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/);
|
|
});
|