mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-11 17:56:19 +02:00
[1.7.0] Add some module unit tests for Edit, Hypertext, Image and Legacy (incomplete). Remove redundant img scaffolding.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1050 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
52
tests/HTMLPurifier/HTMLModule/HypertextTest.php
Normal file
52
tests/HTMLPurifier/HTMLModule/HypertextTest.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
||||
|
||||
class HTMLPurifier_HTMLModule_HypertextTest extends HTMLPurifier_HTMLModuleHarness
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
// max
|
||||
$this->assertResult(
|
||||
'<span>
|
||||
<a
|
||||
href="http://www.example.com/"
|
||||
rel="nofollow"
|
||||
rev="index"
|
||||
>
|
||||
#PCDATA <span>Inline</span>
|
||||
</a>
|
||||
</span>', true, array(
|
||||
'Attr.AllowedRel' => 'nofollow',
|
||||
'Attr.AllowedRev' => 'index'
|
||||
)
|
||||
);
|
||||
|
||||
// invalid children
|
||||
$this->assertResult(
|
||||
'<a>Text<span><a></a></span><div></div><a></a></a>',
|
||||
'<a>Text<span></span></a>'
|
||||
);
|
||||
|
||||
// unsupported attributes
|
||||
$this->assertResult(
|
||||
'<a
|
||||
charset="utf-8"
|
||||
type="text/html"
|
||||
hreflang="en"
|
||||
accesskey="f"
|
||||
shape="rect"
|
||||
coords="0,0,20,0"
|
||||
tabindex="3"
|
||||
onfocus="foo();"
|
||||
onblur="bar();"
|
||||
></a>',
|
||||
'<a></a>'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user