Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Test page content and add test case for TOC scrollable indicat…
…or (#155) Co-authored-by: bwang <bwang@wikimedia.org>
- Loading branch information
1 parent
494600b
commit d83205b
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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 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,13 @@ | ||
module.exports = async ( page ) => { | ||
await page.evaluate( () => { | ||
const tocElement = document.getElementById( 'vector-toc' ); | ||
const tocToggleBtns = tocElement.querySelectorAll( '.vector-toc-toggle' ); | ||
for ( const btn of tocToggleBtns ) { | ||
btn.click(); | ||
} | ||
tocElement.scrollBy( 0, tocElement.scrollHeight ); | ||
// Scroll up 30px from the bottom of the TOC to allow the scrollable indicator to show | ||
tocElement.scrollBy( 0, -30 ); | ||
return true; | ||
} ); | ||
}; |