mirror of https://github.com/vuejs/vitepress
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
801 B
37 lines
801 B
2 years ago
|
describe('outline', () => {
|
||
|
beforeAll(async () => {
|
||
2 years ago
|
await goto('/frontmatter/multiple-levels-outline')
|
||
2 years ago
|
})
|
||
|
|
||
|
test('set outline to deep', async () => {
|
||
2 years ago
|
const outlineLinksLocator = page.locator('.VPDocAsideOutline .outline-link')
|
||
2 years ago
|
|
||
|
const outlineLinksContent = await outlineLinksLocator.allTextContents()
|
||
|
expect(outlineLinksContent).toEqual([
|
||
|
'h2 - 1',
|
||
|
'h3 - 1',
|
||
2 years ago
|
'h4 - 1',
|
||
2 years ago
|
'h3 - 2',
|
||
2 years ago
|
'h4 - 2',
|
||
2 years ago
|
'h2 - 2',
|
||
2 years ago
|
'h3 - 3',
|
||
|
'h4 - 3'
|
||
2 years ago
|
])
|
||
|
|
||
|
const linkHrefs = await outlineLinksLocator.evaluateAll((element) =>
|
||
|
element.map((element) => element.getAttribute('href'))
|
||
|
)
|
||
|
|
||
2 years ago
|
expect(linkHrefs).toEqual([
|
||
|
'#h2-1',
|
||
|
'#h3-1',
|
||
|
'#h4-1',
|
||
|
'#h3-2',
|
||
|
'#h4-2',
|
||
|
'#h2-2',
|
||
|
'#h3-3',
|
||
|
'#h4-3'
|
||
|
])
|
||
2 years ago
|
})
|
||
|
})
|