feat: barre d'outils de lecture epinglee, coloration syntaxique des fichiers de code et avatars predefinis (#115, #117, BUG-078)
This commit is contained in:
@@ -284,6 +284,28 @@ function testSidebarUserSection() {
|
||||
console.log(' ✓ header trimmed + sidebar account section (#112)');
|
||||
}
|
||||
|
||||
// ── Test syntax highlighting follows the theme mode (BUG-078) ──────────────
|
||||
function testSyntaxHighlightTheme() {
|
||||
const themes = readFileSync(join(JS_DIR, 'themes.js'), 'utf-8');
|
||||
const ui = readFileSync(join(JS_DIR, 'ui.js'), 'utf-8');
|
||||
|
||||
// themes.js must swap the highlight.js stylesheets based on the *mode*.
|
||||
const applyTheme = themes.match(/function applyTheme\(themeKey, mode\)\s*\{([\s\S]*?)\n\}/);
|
||||
assert.ok(applyTheme, 'themes.js applyTheme not found');
|
||||
assert.match(applyTheme[1], /hljs-theme-dark/, 'applyTheme must toggle the dark hljs sheet');
|
||||
assert.match(applyTheme[1], /hljs-theme-light/, 'applyTheme must toggle the light hljs sheet');
|
||||
assert.match(applyTheme[1], /mode === 'dark'|mode === "dark"/, 'sheet choice must key on the mode');
|
||||
|
||||
// ui.js must resolve the persisted *mode*, never treat the theme key as one.
|
||||
assert.match(ui, /obsigate-theme-mode/, 'ui.js must read the persisted theme mode');
|
||||
assert.doesNotMatch(
|
||||
ui,
|
||||
/darkSheet\.disabled\s*=\s*theme !== "dark"[\s\S]{0,120}lightSheet\.disabled\s*=\s*theme !== "light"/,
|
||||
'ui.js must not compare the theme key to "dark"/"light" (BUG-078 regression)',
|
||||
);
|
||||
console.log(' ✓ syntax highlighting follows the theme mode (BUG-078)');
|
||||
}
|
||||
|
||||
// ── Run all tests ──────────────────────────────────────────────────────────
|
||||
async function main() {
|
||||
let passed = 0, failed = 0;
|
||||
@@ -300,6 +322,7 @@ async function main() {
|
||||
['ai-fab module exports', testAIFabModuleExports],
|
||||
['config TOC icons', testConfigTocIcons],
|
||||
['sidebar user section', testSidebarUserSection],
|
||||
['syntax highlight theme', testSyntaxHighlightTheme],
|
||||
];
|
||||
|
||||
for (const [name, fn] of tests) {
|
||||
|
||||
Reference in New Issue
Block a user