File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ function NavListItem({ childPage }: { childPage: ProductTreeNode }) {
85
85
86
86
return (
87
87
< NavList . Item
88
- defaultOpen = { routePath . includes ( childPage . href ) }
88
+ defaultOpen = { childPage . childPages . length > 0 && routePath . includes ( childPage . href ) }
89
89
href = { childPage . href }
90
90
aria-current = { isActive ? 'page' : false }
91
91
onClick = { ( event ) => {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ describe('sidebar', () => {
19
19
const $ = await getDOM ( '/get-started/quickstart/hello-world' )
20
20
expect (
21
21
$ (
22
- '[data-testid=sidebar] [data-testid=product-sidebar] nav ul li div ul li a[aria-current="page"] div span' ,
22
+ '[data-testid=sidebar] [data-testid=product-sidebar] a[aria-current="page"] div span' ,
23
23
) . text ( ) ,
24
24
) . toBe ( 'Hello World' )
25
25
} )
@@ -30,15 +30,15 @@ describe('sidebar', () => {
30
30
// from its regular title.
31
31
expect (
32
32
$ (
33
- '[data-testid=sidebar] [data-testid=product-sidebar] nav ul li div ul li a[href*="/get-started/foo/bar"] div span' ,
33
+ '[data-testid=sidebar] [data-testid=product-sidebar] a[href*="/get-started/foo/bar"] div span' ,
34
34
) . text ( ) ,
35
35
) . toBe ( 'Bar' )
36
36
} )
37
37
38
38
test ( 'short titles with Liquid and HTML characters' , async ( ) => {
39
39
const $ = await getDOM ( '/get-started/foo/html-short-title' )
40
40
const link = $ (
41
- '[data-testid=sidebar] [data-testid=product-sidebar] nav ul li div ul li a[href*="/get-started/foo/html-short-title"]' ,
41
+ '[data-testid=sidebar] [data-testid=product-sidebar] a[href*="/get-started/foo/html-short-title"]' ,
42
42
)
43
43
expect ( link . text ( ) ) . toBe ( 'GitHub Pages & "GitHub"' )
44
44
} )
You can’t perform that action at this time.
0 commit comments