Skip to content

Commit

Permalink
Test with multiple level one headings
Browse files Browse the repository at this point in the history
Not recommended to do, but test should cover it
  • Loading branch information
caendesilva committed Mar 22, 2023
1 parent f1a84cd commit 8400b44
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,40 @@ public function testWithMultipleNestedHeadings()
);
}

public function testWithMultipleLevelOneHeadings()
{
$markdown = <<<'MARKDOWN'
# Level 1
## Level 2
### Level 3
# Level 1B
## Level 2B
### Level 3B
MARKDOWN;

$this->assertSameIgnoringIndentation(<<<'HTML'
<ul class="table-of-contents">
<li>
<a href="#level-2">Level 2</a>
<ul>
<li>
<a href="#level-3">Level 3</a>
</li>
</ul>
</li>
<li>
<a href="#level-2b">Level 2B</a>
<ul>
<li>
<a href="#level-3b">Level 3B</a>
</li>
</ul>
</li>
</ul>
HTML, (new GeneratesTableOfContents($markdown))->execute()
);
}

protected function assertSameIgnoringIndentation(string $expected, string $actual): void
{
$this->assertSame(
Expand Down

0 comments on commit 8400b44

Please sign in to comment.