File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,28 @@ Some text\n`;
1212 expect ( result ) . toContain ( '<!-- index-start -->' ) ;
1313 expect ( result ) . toContain ( '<!-- index-end -->' ) ;
1414 } ) ;
15+
16+ it ( 'should not pull content from below H2 headings' , ( ) => {
17+ const mockContent = `# Test
18+
19+ ## A
20+
21+ Some H2 text that should not be pulled to heading
22+
23+ ### B - not pulled
24+
25+ Some H3 text not pulled to heading
26+
27+ ## C
28+
29+ ### D - H3 should not be pulled because parent H2 has no text` ;
30+
31+ const result = findFirstParagraph ( mockContent ) ;
32+ expect ( result ) . toContain ( '## A\n\nSome H2 text that should not be pulled to heading' ) ;
33+ expect ( result ) . toContain ( '## C\n\n### D - H3 should not be pulled because parent H2 has no text' ) ;
34+ expect ( result ) . not . toContain ( '## ASome H2 text' ) ;
35+ expect ( result ) . not . toContain ( '## C### D' ) ;
36+ } ) ;
1537 } ) ;
1638
1739 describe ( 'replacetag (Function)' , ( ) => {
You can’t perform that action at this time.
0 commit comments