mirror of
https://github.com/erusev/parsedown.git
synced 2024-09-20 03:51:29 +02:00
Fix up unit tests following previous commit
This commit is contained in:
parent
7ead769742
commit
cd6912dfb3
@ -554,13 +554,17 @@ class Parsedown
|
|||||||
|
|
||||||
$text = trim($text, ' ');
|
$text = trim($text, ' ');
|
||||||
$link = strtolower(str_replace(' ','-',$text));
|
$link = strtolower(str_replace(' ','-',$text));
|
||||||
|
$attr = array();
|
||||||
|
if (!empty($link)) {
|
||||||
|
$attr = array(
|
||||||
|
'id' => $link,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$Block = array(
|
$Block = array(
|
||||||
'element' => array(
|
'element' => array(
|
||||||
'name' => 'h' . $level,
|
'name' => 'h' . $level,
|
||||||
'attributes' => array(
|
'attributes' => $attr,
|
||||||
'id' => $link,
|
|
||||||
),
|
|
||||||
'handler' => array(
|
'handler' => array(
|
||||||
'function' => 'lineElements',
|
'function' => 'lineElements',
|
||||||
'argument' => $text,
|
'argument' => $text,
|
||||||
|
@ -54,8 +54,10 @@ class ParsedownTest extends TestCase
|
|||||||
$this->Parsedown->setStrictMode(substr($test, 0, 6) === 'strict');
|
$this->Parsedown->setStrictMode(substr($test, 0, 6) === 'strict');
|
||||||
|
|
||||||
$actualMarkup = $this->Parsedown->text($markdown);
|
$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()
|
function testRawHtml()
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<h1>h1</h1>
|
<h1 id="h1">h1</h1>
|
||||||
<h2>h2</h2>
|
<h2 id="h2">h2</h2>
|
||||||
<h3>h3</h3>
|
<h3 id="h3">h3</h3>
|
||||||
<h4>h4</h4>
|
<h4 id="h4">h4</h4>
|
||||||
<h5>h5</h5>
|
<h5 id="h5">h5</h5>
|
||||||
<h6>h6</h6>
|
<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>
|
<h1></h1>
|
||||||
<h2></h2>
|
<h2></h2>
|
||||||
<h1># of levels</h1>
|
<h1 id="#-of-levels"># of levels</h1>
|
||||||
<h1># of levels #</h1>
|
<h1 id="#-of-levels-#"># of levels #</h1>
|
||||||
<h1>heading</h1>
|
<h1 id="heading">heading</h1>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<h1>h1</h1>
|
<h1 id="h1">h1</h1>
|
||||||
<h2>h2</h2>
|
<h2 id="h2">h2</h2>
|
||||||
<h3>h3</h3>
|
<h3 id="h3">h3</h3>
|
||||||
<h4>h4</h4>
|
<h4 id="h4">h4</h4>
|
||||||
<h5>h5</h5>
|
<h5 id="h5">h5</h5>
|
||||||
<h6>h6</h6>
|
<h6 id="h6">h6</h6>
|
||||||
<p>####### not a heading</p>
|
<p>####### not a heading</p>
|
||||||
<p>#not a heading</p>
|
<p>#not a heading</p>
|
||||||
<h1>closed h1</h1>
|
<h1 id="closed-h1">closed h1</h1>
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<h2></h2>
|
<h2></h2>
|
||||||
<h1># of levels</h1>
|
<h1 id="#-of-levels"># of levels</h1>
|
||||||
<h1># of levels #</h1>
|
<h1 id="#-of-levels-#"># of levels #</h1>
|
||||||
|
Loading…
Reference in New Issue
Block a user