Skip to content

Commit f10c879

Browse files
committed
test(FR-2912): assert preview:html sidebar nav is wrapped in .doc-sidebar__scroll
1 parent 2755b1a commit f10c879

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

packages/backend.ai-docs-toolkit/src/html-builder-web.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,23 @@ test("buildWebDocument — works without config (preview-mode default branding)"
5959
const html = buildWebDocument(sampleChapters, meta);
6060
assert.ok(html.length > 0);
6161
});
62+
63+
test("buildWebDocument — wraps sidebar nav inside .doc-sidebar__scroll (FR-2768 regression guard)", () => {
64+
// FR-2768 made .doc-sidebar a fixed-height, overflow:hidden flex column and
65+
// delegated scrolling to an inner .doc-sidebar__scroll element. If the nav
66+
// is not wrapped in that element, the sidebar can't scroll on overflow.
67+
const html = buildWebDocument(sampleChapters, meta);
68+
69+
const sidebarMatch = html.match(/<aside class="doc-sidebar">[\s\S]*?<\/aside>/);
70+
assert.ok(sidebarMatch, ".doc-sidebar aside not found");
71+
const sidebarHtml = sidebarMatch[0];
72+
73+
const scrollIdx = sidebarHtml.indexOf('class="doc-sidebar__scroll"');
74+
const navIdx = sidebarHtml.indexOf('class="doc-sidebar-nav"');
75+
assert.notStrictEqual(scrollIdx, -1, ".doc-sidebar__scroll wrapper missing from sidebar");
76+
assert.notStrictEqual(navIdx, -1, ".doc-sidebar-nav missing from sidebar");
77+
assert.ok(
78+
scrollIdx < navIdx,
79+
".doc-sidebar-nav must be nested inside the .doc-sidebar__scroll wrapper",
80+
);
81+
});

0 commit comments

Comments
 (0)