@@ -311,4 +311,54 @@ describe('toc', () => {
311
311
312
312
toc ( html , { max_depth : 2 } ) . should . eql ( expected ) ;
313
313
} ) ;
314
+
315
+ it ( 'min_depth' , ( ) => {
316
+ const className = 'toc' ;
317
+ const expected = [
318
+ '<ol class="' + className + '">' ,
319
+ '<li class="' + className + '-item toc-level-2">' ,
320
+ '<a class="' + className + '-link" href="#title_1_1">' ,
321
+ '<span class="' + className + '-number">1.</span> ' ,
322
+ '<span class="' + className + '-text">Title 1.1</span>' ,
323
+ '</a>' ,
324
+ '<ol class="' + className + '-child">' ,
325
+ '<li class="' + className + '-item toc-level-3">' ,
326
+ '<a class="' + className + '-link" href="#title_1_1_1">' ,
327
+ '<span class="' + className + '-number">1.1.</span> ' ,
328
+ '<span class="' + className + '-text">Title 1.1.1</span>' ,
329
+ '</a>' ,
330
+ '</li>' ,
331
+ '</ol>' ,
332
+ '</li>' ,
333
+ '<li class="' + className + '-item toc-level-2">' ,
334
+ '<a class="' + className + '-link" href="#title_1_2">' ,
335
+ '<span class="' + className + '-number">2.</span> ' ,
336
+ '<span class="' + className + '-text">Title 1.2</span>' ,
337
+ '</a>' ,
338
+ '</li>' ,
339
+ '<li class="' + className + '-item toc-level-2">' ,
340
+ '<a class="' + className + '-link" href="#title_1_3">' ,
341
+ '<span class="' + className + '-number">3.</span> ' ,
342
+ '<span class="' + className + '-text">Title 1.3</span>' ,
343
+ '</a>' ,
344
+ '<ol class="' + className + '-child">' ,
345
+ '<li class="' + className + '-item toc-level-3">' ,
346
+ '<a class="' + className + '-link" href="#title_1_3_1">' ,
347
+ '<span class="' + className + '-number">3.1.</span> ' ,
348
+ '<span class="' + className + '-text">Title 1.3.1</span>' ,
349
+ '</a>' ,
350
+ '</li>' ,
351
+ '</ol>' ,
352
+ '</li>' ,
353
+ '<li class="' + className + '-item toc-level-2">' ,
354
+ '<a class="' + className + '-link" href="#title_2_1">' ,
355
+ '<span class="' + className + '-number">4.</span> ' ,
356
+ '<span class="' + className + '-text">Title 2.1</span>' ,
357
+ '</a>' ,
358
+ '</li>' ,
359
+ '</ol>'
360
+ ] . join ( '' ) ;
361
+
362
+ toc ( html , { min_depth : 2 } ) . should . eql ( expected ) ;
363
+ } ) ;
314
364
} ) ;
0 commit comments