1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 01:54:12 +02:00

Linkwords: Ignore commented HTML code during processing.

This commit is contained in:
Cameron
2022-03-15 13:47:46 -07:00
parent c737e0c550
commit 8f2776bc46
2 changed files with 22 additions and 5 deletions

View File

@@ -81,13 +81,22 @@
'text' => "<h3>Body only title</h3><p>body only text</p>",
'expected' => "<h3>Body only title</h3><p><a class=\"lw-link lw-1\" href=\"/body-link\" >body only</a> text</p>",
),
// Ignore commented code.
6 => array(
'text' => "<!-- <div>Body only title</div> --> <p>body only text</p>",
'expected' => "<!-- <div>Body only title</div> --> <p><a class=\"lw-link lw-2\" href=\"/body-link\" >body only</a> text</p>",
),
7 => array(
'text' => "contact us link <p>body only text</p>",
'expected' => '<a class="lw-tip lw-link lw-2" href="/contact.php" title="Contact Us Now" >contact us</a> <a class="lw-link lw-2" href="/page-link" >link</a> <p><a class="lw-link lw-3" href="/body-link" >body only</a> text</p>',
),
);
foreach($tests as $val)
foreach($tests as $index => $val)
{
$result = $this->lw->toHTML($val['text'], 'BODY');
$this->assertEquals($val['expected'],$result);
$this->assertEquals($val['expected'],$result, 'Test #'.$index.' failed. ');
}