Skip to content

Commit 3714ea3

Browse files
authored
fix(theme): show outline even without sidebar (#1189)
1 parent a8834ac commit 3714ea3

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

examples/minimal/__test__/content.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ describe('render corrent content', () => {
77
})
88

99
test('main content', async () => {
10-
const h1Locator = await page.locator('h1')
11-
const h2Locator = await page.locator('h2')
12-
const pLocator = await page.locator('.Layout p')
10+
const h1Locator = page.locator('h1')
11+
const h2Locator = page.locator('h2')
12+
const pLocator = page.locator('.Layout p')
1313

1414
const [h1Contents, h2Conetents, pContents] = await Promise.all([
1515
h1Locator.allTextContents(),
@@ -28,11 +28,11 @@ describe('render corrent content', () => {
2828
})
2929

3030
test('outline', async () => {
31-
const outlineLinksLocator = await page.locator(
31+
const outlineLinksLocator = page.locator(
3232
'.VPDocAsideOutline .root .outline-link'
3333
)
3434

3535
const outlineLinksCount = await outlineLinksLocator.count()
36-
expect(outlineLinksCount).toEqual(0)
36+
expect(outlineLinksCount).toEqual(4)
3737
})
3838
})

src/client/theme-default/components/VPDoc.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ const pageName = computed(() =>
7373
max-width: 992px;
7474
}
7575
76-
.VPDoc:not(.has-sidebar) .aside {
77-
display: block;
78-
}
79-
8076
.VPDoc:not(.has-sidebar) .content {
8177
max-width: 752px;
8278
}

src/client/theme-default/composables/sidebar.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@ export function useSidebar() {
2323
})
2424

2525
const hasAside = computed(() => {
26-
if (
27-
frontmatter.value.layout !== 'home' &&
28-
frontmatter.value.aside === false
26+
return (
27+
frontmatter.value.layout !== 'home' && frontmatter.value.aside !== false
2928
)
30-
return false
31-
32-
return hasSidebar.value
3329
})
3430

3531
function open() {

0 commit comments

Comments
 (0)