Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Elastic.ApiExplorer/_Partials/Layout/_ApiToc.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<div class="font-sans">
<div class="font-bold mb-2">On this page</div>
<div class="relative toc-progress-container font-body">
<div class="toc-progress-indicator absolute top-0 h-0 w-[1px] bg-blue-elastic transition-[transform,height] duration-200 ease-out"></div>
<div class="toc-progress-indicator absolute top-0 h-0 w-[1px] bg-blue-elastic transition-transform duration-200 ease-out"></div>
<ul class="block w-full">
@foreach (var item in Model)
{
<li class="has-[:hover]:border-l-grey-80 items-center px-4 border-l-1 border-l-grey-20 has-[.toc-current]:border-l-blue-elastic!">
<li class="has-[:hover]:border-l-grey-80 items-center px-4 border-l-1 border-l-grey-20 [&.toc-current]:border-l-blue-elastic!">
<a class="sidebar-link inline-block my-1.5 @(item.Level == 3 ? "ml-4" : string.Empty)"
href="#@item.Slug">
@item.Heading
Expand Down
7 changes: 4 additions & 3 deletions src/Elastic.Documentation.Site/Assets/toc-nav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ describe('TOC navigation', () => {
'.toc-progress-indicator'
) as HTMLElement
expect(tocLink).toHaveClass('toc-current')
expect(tocItem).toHaveClass('toc-current')
expect(indicator).toHaveStyle({
top: '0px',
height: '24px',
Expand Down Expand Up @@ -281,7 +282,7 @@ describe('TOC navigation', () => {
(calls, mock) => calls + mock.mock.calls.length,
0
)
).toBeGreaterThan(0)
).toBe(0)
})

it('does not rewrite classes when the current heading is unchanged', () => {
Expand All @@ -302,7 +303,7 @@ describe('TOC navigation', () => {
expect(addSpies.every((spy) => spy.mock.calls.length === 0)).toBe(true)
})

it('only reads nearby heading geometry during steady scrolling', () => {
it('does not read heading geometry during steady scrolling', () => {
const fixture = createTocFixture(
Array.from({ length: 50 }, (_, index) => 100 + index * 200)
)
Expand All @@ -315,7 +316,7 @@ describe('TOC navigation', () => {
(calls, mock) => calls + mock.mock.calls.length,
0
)
expect(geometryReads).toBeLessThanOrEqual(3)
expect(geometryReads).toBe(0)
})

it('removes listeners from the previous initialization', () => {
Expand Down
Loading
Loading