-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix: fix loadSider false render structure issue #2470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
86ad7f3
fix: fix loadSider false render structure issue
Koooooo-7 378b85e
Merge branch 'develop' into fix-loadsidebar
Koooooo-7 20bf3a6
update: resolve merge conflict
Koooooo-7 0c21a1d
chore: fix ci
Koooooo-7 df5b9ec
chore: fix ci
Koooooo-7 31d3295
chore: fix ci
Koooooo-7 97b25f2
chore: fix ci
Koooooo-7 a942713
remove sidebar call in renderMain
Koooooo-7 d4c13a1
Merge branch 'develop' into fix-loadsidebar
Koooooo-7 8cf4640
fix:ci
Koooooo-7 73a6d14
chore: fix ci
Koooooo-7 5840fc4
chore: fix ci on jest
Koooooo-7 d3efb1d
chore: fix ci on jest
Koooooo-7 5224486
revert ci config
Koooooo-7 7628817
update: remove all sidebar.test.hs
Koooooo-7 6c83909
update: remove all sidebar.test.js
Koooooo-7 cd5988c
update: add test case1 for sidebar.test.js
Koooooo-7 a6fb2dd
update: replace to add no sidebar config test in sidebar.test.js
Koooooo-7 3364b33
update: reduce css selector verify case
Koooooo-7 9e8246b
dope
Koooooo-7 98fc093
dope2
Koooooo-7 d563679
Merge branch 'develop' into fix-loadsidebar
Koooooo-7 82ae5f5
fix: ci
Koooooo-7 3a0b3b3
huge: it seems I still need remove the --runInBand
Koooooo-7 32635ba
fix: remove page h1 heading in sidebar and correct class for ul
Koooooo-7 6b1fa06
update: put class on top ul elm
Koooooo-7 3612bf8
update: put class on top ul elm
Koooooo-7 1c82921
try add runInBand
Koooooo-7 b08908f
Merge branch 'develop' into fix-loadsidebar
Koooooo-7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import docsifyInit from '../helpers/docsify-init.js'; | ||
import { expect } from '@playwright/test'; | ||
|
||
describe('Test sidebar render toc structure', function () { | ||
test('Render sidebar with loadSidebar=true and the _sidebar.md file', async () => { | ||
await docsifyInit({ | ||
config: { | ||
loadSidebar: '_sidebar.md', | ||
}, | ||
markdown: { | ||
homepage: '# Hello World', | ||
sidebar: ` | ||
- Getting started | ||
- [Level1](QuickStart.md) | ||
- [Level2](QuickStart2.md) | ||
`, | ||
}, | ||
waitForSelector: '.sidebar-nav > ul', | ||
}); | ||
|
||
const sidebarElm = document.querySelector('.sidebar'); | ||
/** | ||
* Expected render result | ||
* ========================== | ||
*<ul> | ||
* <li> | ||
* Getting started | ||
* <ul> | ||
* <li> | ||
* <a href="#/QuickStart" title="Level1">Level1</a> | ||
* <ul> | ||
* <li><a href="#/QuickStart2" title="Level2">Level2</a></li> | ||
* </ul> | ||
* </li> | ||
* </ul> | ||
* </li> | ||
* </ul> | ||
*/ | ||
|
||
const GettingStarted = document.querySelector('.sidebar-nav > ul > li'); | ||
const level1_Elm = document.querySelector( | ||
'.sidebar-nav > ul > li > ul> li', | ||
); | ||
const level1_A_tag = level1_Elm.querySelector('a'); | ||
|
||
const level2_Elm = level1_Elm.querySelector(' ul > li '); | ||
|
||
const level2_A_tag = level2_Elm.querySelector('a'); | ||
|
||
expect(sidebarElm).not.toBeNull(); | ||
expect(GettingStarted).not.toBeNull(); | ||
expect(level1_Elm).not.toBeNull(); | ||
expect(level1_A_tag).not.toBeNull(); | ||
expect(level2_Elm).not.toBeNull(); | ||
expect(level2_A_tag).not.toBeNull(); | ||
expect(level1_A_tag.textContent).toContain('Level1'); | ||
expect(level2_A_tag.textContent).toContain('Level2'); | ||
}); | ||
|
||
test('Render sidebar with loadSidebar=false should be same to loadSidebar=true sidebar structure', async () => { | ||
await docsifyInit({ | ||
config: { | ||
loadSidebar: false, | ||
}, | ||
markdown: { | ||
homepage: ` | ||
# Getting started | ||
some thing | ||
## Level1 | ||
foo | ||
### Level2 | ||
bar | ||
`, | ||
}, | ||
waitForSelector: '.sidebar-nav > ul', | ||
}); | ||
|
||
const sidebarElm = document.querySelector('.sidebar'); | ||
/** | ||
* Expected render result | ||
* ========================== | ||
*<ul> | ||
* <li> | ||
* Getting started | ||
* <ul> | ||
* <li> | ||
* <a href="#/QuickStart" title="Level1">Level1</a> | ||
* <ul> | ||
* <li><a href="#/QuickStart2" title="Level2">Level2</a></li> | ||
* </ul> | ||
* </li> | ||
* </ul> | ||
* </li> | ||
* </ul> | ||
*/ | ||
|
||
const GettingStarted = document.querySelector('.sidebar-nav > ul > li'); | ||
const level1_Elm = document.querySelector( | ||
'.sidebar-nav > ul > li > ul> li', | ||
); | ||
const level1_A_tag = level1_Elm.querySelector('a'); | ||
|
||
const level2_Elm = level1_Elm.querySelector(' ul > li '); | ||
|
||
const level2_A_tag = level2_Elm.querySelector('a'); | ||
|
||
expect(sidebarElm).not.toBeNull(); | ||
expect(GettingStarted).not.toBeNull(); | ||
expect(level1_Elm).not.toBeNull(); | ||
expect(level1_A_tag).not.toBeNull(); | ||
expect(level2_Elm).not.toBeNull(); | ||
expect(level2_A_tag).not.toBeNull(); | ||
expect(level1_A_tag.textContent).toContain('Level1'); | ||
expect(level2_A_tag.textContent).toContain('Level2'); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.