Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/Markdown/MarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ public function it_uses_heading_permalinks_on_demand()
<h2>Charlie Delta</h2>
EOT, $markdown);

// Make assertion without the tabindex attribute because it's only added in commonmark 2.9.2 and later.
$this->assertEquals(<<<'EOT'
<h2><a id="content-alfa-bravo" href="#content-alfa-bravo" class="heading-permalink" aria-hidden="true" title="Permalink">¶</a>Alfa Bravo</h2>
<h2><a id="content-charlie-delta" href="#content-charlie-delta" class="heading-permalink" aria-hidden="true" title="Permalink">¶</a>Charlie Delta</h2>
EOT,
rtrim(Markdown::withHeadingPermalinks()->parse($markdown))
str_replace(' tabindex="-1"', '', rtrim(Markdown::withHeadingPermalinks()->parse($markdown)))
);
}

Expand Down Expand Up @@ -289,10 +290,11 @@ public function it_uses_table_of_contents_on_demand()
<p>Baz qux.</p>
EOT;

// Make assertion without newlines because they differ between versions of commonmark.
// Make assertion without newlines because they differ between versions of commonmark,
// and without the tabindex attribute because it's only added in 2.9.2 and later.
$this->assertEquals(
str($expected)->replace("\n", ''),
str(Markdown::withTableOfContents()->parse($markdown))->trim()->replace("\n", '')
str(Markdown::withTableOfContents()->parse($markdown))->trim()->replace("\n", '')->replace(' tabindex="-1"', '')
);
}
}
Loading