Skip to content

Commit 9c645b4

Browse files
committed
Add test for no logo and active nav
1 parent 6c935f2 commit 9c645b4

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
**/*.quarto_ipynb
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
project:
2+
type: website
3+
4+
website:
5+
title: "Issue 13506 - No Logo"
6+
navbar:
7+
left:
8+
- text: "Section A"
9+
href: index.qmd
10+
- text: "Section B"
11+
href: page2.qmd
12+
sidebar:
13+
- title: "Section A"
14+
contents:
15+
- index.qmd
16+
- title: "Section B"
17+
contents:
18+
- page2.qmd
19+
20+
format:
21+
html:
22+
theme: cosmo
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Section A"
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
-
8+
- 'nav.navbar a.nav-link[href$="index.html"].active'
9+
- 'nav.navbar a.nav-link[href$="page2.html"]:not(.active)'
10+
-
11+
- 'a.sidebar-logo-link'
12+
---
13+
14+
## Section A
15+
16+
This is Section A. When NO logo is configured in the sidebar, the navbar active
17+
state should work correctly. The "Section A" navbar item should be active on this page.
18+
19+
The bug (issue #13506): After PR #12996, `sidebar.logo` was normalized to
20+
`{light: undefined, dark: undefined}`, making `if(sidebar.logo)` always true.
21+
This created empty `<a class="sidebar-logo-link">` elements that interfered with
22+
the navbar active state detection logic.
23+
24+
See also: [Section B](page2.qmd)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Section B"
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
-
8+
- 'nav.navbar a.nav-link[href$="page2.html"].active'
9+
- 'nav.navbar a.nav-link[href$="index.html"]:not(.active)'
10+
-
11+
- 'a.sidebar-logo-link'
12+
---
13+
14+
## Section B
15+
16+
This is Section B. The "Section B" navbar item should be active on this page,
17+
demonstrating that the navbar active state detection works correctly without
18+
empty logo links interfering.
19+
20+
See also: [Section A](index.qmd)

0 commit comments

Comments
 (0)