Skip to content

Commit

Permalink
fix(theme): show outline even without sidebar (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd authored Aug 17, 2022
1 parent a8834ac commit 3714ea3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 5 additions & 5 deletions examples/minimal/__test__/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ describe('render corrent content', () => {
})

test('main content', async () => {
const h1Locator = await page.locator('h1')
const h2Locator = await page.locator('h2')
const pLocator = await page.locator('.Layout p')
const h1Locator = page.locator('h1')
const h2Locator = page.locator('h2')
const pLocator = page.locator('.Layout p')

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

test('outline', async () => {
const outlineLinksLocator = await page.locator(
const outlineLinksLocator = page.locator(
'.VPDocAsideOutline .root .outline-link'
)

const outlineLinksCount = await outlineLinksLocator.count()
expect(outlineLinksCount).toEqual(0)
expect(outlineLinksCount).toEqual(4)
})
})
4 changes: 0 additions & 4 deletions src/client/theme-default/components/VPDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ const pageName = computed(() =>
max-width: 992px;
}
.VPDoc:not(.has-sidebar) .aside {
display: block;
}
.VPDoc:not(.has-sidebar) .content {
max-width: 752px;
}
Expand Down
8 changes: 2 additions & 6 deletions src/client/theme-default/composables/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ export function useSidebar() {
})

const hasAside = computed(() => {
if (
frontmatter.value.layout !== 'home' &&
frontmatter.value.aside === false
return (
frontmatter.value.layout !== 'home' && frontmatter.value.aside !== false
)
return false

return hasSidebar.value
})

function open() {
Expand Down

0 comments on commit 3714ea3

Please sign in to comment.