Skip to content

Commit

Permalink
feat(theme-default): heading-sidebar (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
nruffing authored Jan 28, 2024
1 parent bbaee39 commit 0ac591d
Show file tree
Hide file tree
Showing 11 changed files with 1,249 additions and 785 deletions.
5 changes: 5 additions & 0 deletions e2e/docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineClientConfig } from '@vuepress/client'

export default defineClientConfig({
//
})
1 change: 1 addition & 0 deletions e2e/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default defineUserConfig({
],
},
],
'/heading-sidebar/': 'heading',
},
}),
}) as UserConfig
Binary file added e2e/docs/.vuepress/public/favicon.ico
Binary file not shown.
Binary file added e2e/docs/.vuepress/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions e2e/docs/heading-sidebar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# heading-sidebar

## header 1

## header 2

## header 3
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.2",
"@vuepress/bundler-webpack": "2.0.0-rc.2",
"@vuepress/client": "2.0.0-rc.2",
"@vuepress/theme-default": "workspace:*",
"sass": "^1.70.0",
"sass-loader": "^14.0.0",
Expand Down
37 changes: 37 additions & 0 deletions e2e/tests/theme-default/composables/useSidebarItems.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
it("route has 'heading' sidebar", () => {
cy.visit('/heading-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('/sidebar/')
cy.get('.theme-default-content').then((el) => {
cy.wrap(el).get('.sidebar-heading').should('contain', 'Sidebar')
cy.wrap(el)
.get('a.sidebar-item')
.should('contain', 'Sidebar Heading 1')
.should('contain', 'Sidebar Heading 2')
})
})
Loading

0 comments on commit 0ac591d

Please sign in to comment.