Skip to content

Commit

Permalink
feat(theme-default): wip (close vuepress#17, vuepress#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
nruffing committed Jan 21, 2024
1 parent 1d46282 commit c85eab1
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 30 deletions.
34 changes: 22 additions & 12 deletions e2e/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,33 @@ export default defineUserConfig({

theme: defaultTheme({
logo: '/logo.png',
navbar: [],
sidebar: 'auto',
}),
})

/*
{
navbar: [
{
text: 'Home',
link: '/',
},
{
text: 'Auto Sidebar',
link: '/auto-sidebar/',
},
{
text: 'Custom Sidebar',
link: '/custom-sidebar/',
},
],
sidebar: {
'/': 'auto',
'/auto-sidebar/': 'auto',
'/custom-sidebar/': [
{
text: 'Page 1',
text: 'custom-sidebar',
link: '/custom-sidebar/',
children: [
'/custom-sidebar/page-one.md',
'/custom-sidebar/page-two.md',
{ text: 'custom-child-1', link: '/custom-sidebar/custom-one' },
{ text: 'custom-child-2', link: '/custom-sidebar/custom-two' },
],
},
],
}
*/
},
}),
})
6 changes: 5 additions & 1 deletion e2e/docs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
foo
# Home

## header 1

## header 2
8 changes: 7 additions & 1 deletion e2e/docs/auto-sidebar/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
foo
# auto-sidebar

## header 1

## header 2

## header 3
1 change: 0 additions & 1 deletion e2e/docs/auto-sidebar/page-one.md

This file was deleted.

1 change: 0 additions & 1 deletion e2e/docs/auto-sidebar/page-two.md

This file was deleted.

8 changes: 7 additions & 1 deletion e2e/docs/custom-sidebar/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
foo
# custom-sidebar

## header 1

## header 2

## header 3
1 change: 1 addition & 0 deletions e2e/docs/custom-sidebar/custom-one.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# custom-one
1 change: 1 addition & 0 deletions e2e/docs/custom-sidebar/custom-two.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# custom-two
1 change: 0 additions & 1 deletion e2e/docs/custom-sidebar/page-one.md

This file was deleted.

1 change: 0 additions & 1 deletion e2e/docs/custom-sidebar/page-two.md

This file was deleted.

38 changes: 36 additions & 2 deletions e2e/tests/theme-default/composables/useSidebarItems.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
it('global auto sidebar', () => {
expect(true).to.equal(true)
it("route has 'auto' sidebar", () => {
cy.visit('/auto-sidebar/')
cy.get('.theme-default-content').then((el) => {
cy.wrap(el)
.get('h1')
.invoke('text')
.should('be.not.empty')
.then((text) => {
cy.get('.sidebar-heading')
.invoke('text')
.should('contain', text.replace('#', '').trim())
})
cy.wrap(el)
.get('h2')
.each((header) => {
cy.wrap(header)
.invoke('text')
.should('be.not.empty')
.then((headerText) => {
cy.get('a.sidebar-item').contains(
headerText.replace('#', '').trim(),
)
})
})
})
})

it('route has custom sidebar', () => {
cy.visit('/custom-sidebar/')
cy.get('.theme-default-content').then((el) => {
cy.wrap(el).get('.sidebar-heading').should('contain', 'custom-sidebar')
cy.wrap(el)
.get('a.sidebar-item')
.should('contain', 'custom-child-1')
.should('contain', 'custom-child-2')
})
})

This file was deleted.

0 comments on commit c85eab1

Please sign in to comment.