File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,36 @@ test.describe('Plugins', () => {
158158 } ) ;
159159 } ) ;
160160
161+ test . describe ( 'doneEach()' , ( ) => {
162+ test ( 'callback after cover loads' , async ( { page } ) => {
163+ const consoleMessages = [ ] ;
164+
165+ page . on ( 'console' , msg => consoleMessages . push ( msg . text ( ) ) ) ;
166+
167+ await docsifyInit ( {
168+ config : {
169+ plugins : [
170+ function ( hook ) {
171+ hook . doneEach ( ( ) => {
172+ const homepageTitle = document . querySelector ( '#homepage-title' ) ;
173+ const coverTitle = document . querySelector ( '#cover-title' ) ;
174+ console . log ( homepageTitle ?. textContent ) ;
175+ console . log ( coverTitle ?. textContent ) ;
176+ } ) ;
177+ } ,
178+ ] ,
179+ } ,
180+ markdown : {
181+ homepage : '# Hello World :id=homepage-title' ,
182+ coverpage : '# Cover Page :id=cover-title' ,
183+ } ,
184+ // _logHTML: true,
185+ } ) ;
186+
187+ await expect ( consoleMessages ) . toEqual ( [ 'Hello World' , 'Cover Page' ] ) ;
188+ } ) ;
189+ } ) ;
190+
161191 test . describe ( 'route data accessible to plugins' , ( ) => {
162192 let routeData = null ;
163193
You can’t perform that action at this time.
0 commit comments