From 3714ea34635e69aa96de3da5f3cbc5b6198fdbc2 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 17 Aug 2022 16:33:17 +0530 Subject: [PATCH] fix(theme): show outline even without sidebar (#1189) --- examples/minimal/__test__/content.spec.ts | 10 +++++----- src/client/theme-default/components/VPDoc.vue | 4 ---- src/client/theme-default/composables/sidebar.ts | 8 ++------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/examples/minimal/__test__/content.spec.ts b/examples/minimal/__test__/content.spec.ts index 317018723e09..f0bb4fc19e23 100644 --- a/examples/minimal/__test__/content.spec.ts +++ b/examples/minimal/__test__/content.spec.ts @@ -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(), @@ -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) }) }) diff --git a/src/client/theme-default/components/VPDoc.vue b/src/client/theme-default/components/VPDoc.vue index f8979a5e5a28..7b29fd37a0fb 100644 --- a/src/client/theme-default/components/VPDoc.vue +++ b/src/client/theme-default/components/VPDoc.vue @@ -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; } diff --git a/src/client/theme-default/composables/sidebar.ts b/src/client/theme-default/composables/sidebar.ts index 414c5558f3b1..7cb1b05509fd 100644 --- a/src/client/theme-default/composables/sidebar.ts +++ b/src/client/theme-default/composables/sidebar.ts @@ -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() {