Fix up unit tests following previous commit

This commit is contained in:
netniV 2020-04-30 22:45:08 +00:00
parent 7ead769742
commit cd6912dfb3
4 changed files with 32 additions and 26 deletions

View File

@ -554,13 +554,17 @@ class Parsedown
$text = trim($text, ' ');
$link = strtolower(str_replace(' ','-',$text));
$attr = array();
if (!empty($link)) {
$attr = array(
'id' => $link,
);
}
$Block = array(
'element' => array(
'name' => 'h' . $level,
'attributes' => array(
'id' => $link,
),
'attributes' => $attr,
'handler' => array(
'function' => 'lineElements',
'argument' => $text,

View File

@ -54,8 +54,10 @@ class ParsedownTest extends TestCase
$this->Parsedown->setStrictMode(substr($test, 0, 6) === 'strict');
$actualMarkup = $this->Parsedown->text($markdown);
$actualMarkup = str_replace("\r\n", "\n", $actualMarkup);
$actualMarkup = str_replace("\r", "\n", $actualMarkup);
$this->assertEquals($expectedMarkup, $actualMarkup);
$this->assertEquals(trim($expectedMarkup), trim($actualMarkup));
}
function testRawHtml()

View File

@ -1,13 +1,13 @@
<h1>h1</h1>
<h2>h2</h2>
<h3>h3</h3>
<h4>h4</h4>
<h5>h5</h5>
<h6>h6</h6>
<p>####### not a heading</p>
<h1>closed h1</h1>
<h1></h1>
<h2></h2>
<h1># of levels</h1>
<h1># of levels #</h1>
<h1>heading</h1>
<h1 id="h1">h1</h1>
<h2 id="h2">h2</h2>
<h3 id="h3">h3</h3>
<h4 id="h4">h4</h4>
<h5 id="h5">h5</h5>
<h6 id="h6">h6</h6>
<p>####### not a heading</p>
<h1 id="closed-h1">closed h1</h1>
<h1></h1>
<h2></h2>
<h1 id="#-of-levels"># of levels</h1>
<h1 id="#-of-levels-#"># of levels #</h1>
<h1 id="heading">heading</h1>

View File

@ -1,13 +1,13 @@
<h1>h1</h1>
<h2>h2</h2>
<h3>h3</h3>
<h4>h4</h4>
<h5>h5</h5>
<h6>h6</h6>
<h1 id="h1">h1</h1>
<h2 id="h2">h2</h2>
<h3 id="h3">h3</h3>
<h4 id="h4">h4</h4>
<h5 id="h5">h5</h5>
<h6 id="h6">h6</h6>
<p>####### not a heading</p>
<p>#not a heading</p>
<h1>closed h1</h1>
<h1 id="closed-h1">closed h1</h1>
<h1></h1>
<h2></h2>
<h1># of levels</h1>
<h1># of levels #</h1>
<h1 id="#-of-levels"># of levels</h1>
<h1 id="#-of-levels-#"># of levels #</h1>