1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-02 12:21:09 +02:00

[1.7.0] Refactor HTMLModule unit tests

- AttrCollections does not barf when an inclusion is not present
- HTMLDefinition configuration directives now use new syntax
- Added %HTML.AllowedModules and %HTML.CoreModules for testing
- Extend Harness so that it can accept a default configuration object member variable
- Refactor modules to use Scaffolding, which defines some custom attributes that allows for the easy testing of attribute collections

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1082 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-05-20 22:29:31 +00:00
parent 2945f6a930
commit a470fc5621
12 changed files with 190 additions and 67 deletions

View File

@@ -7,21 +7,15 @@ class HTMLPurifier_HTMLModule_BdoTest extends HTMLPurifier_HTMLModuleHarness
function test() {
$this->setupScaffold('Bdo');
// max
$this->assertResult(
'<span>
<bdo
id="test-id"
class="class-name"
style="font-weight:bold;"
title="Title of tag"
lang="en"
xml:lang="en"
dir="rtl"
>
<bdo ac:core="yes" dir="rtl">
#PCDATA <span>Inline</span>
</bdo>
</span>', true, array('Attr.EnableID' => true)
</span>'
);
// min

View File

@@ -7,21 +7,23 @@ class HTMLPurifier_HTMLModule_EditTest extends HTMLPurifier_HTMLModuleHarness
function test() {
$this->setupScaffold('Edit');
// max
$this->assertResult(
'<span>
<ins cite="http://www.example.com/">
<ins cite="http://www.example.com/" ac:common="yes">
#PCDATA <span></span>
</ins>
<del cite="http://www.example.com/">
<del cite="http://www.example.com/" ac:common="yes">
#PCDATA <span></span>
</del>
</span>
<div>
<ins cite="http://www.example.com/">
<ins cite="http://www.example.com/" ac:common="yes">
#PCDATA <div></div> <span></span>
</ins>
<del cite="http://www.example.com/">
<del cite="http://www.example.com/" ac:common="yes">
#PCDATA <div></div> <span></span>
</del>
</div>'

View File

@@ -7,6 +7,11 @@ class HTMLPurifier_HTMLModule_HypertextTest extends HTMLPurifier_HTMLModuleHarne
function test() {
$this->setupScaffold('Hypertext', array(
'Attr.AllowedRel' => 'nofollow',
'Attr.AllowedRev' => 'index'
));
// max
$this->assertResult(
'<span>
@@ -14,13 +19,11 @@ class HTMLPurifier_HTMLModule_HypertextTest extends HTMLPurifier_HTMLModuleHarne
href="http://www.example.com/"
rel="nofollow"
rev="index"
ac:common="true"
>
#PCDATA <span>Inline</span>
</a>
</span>', true, array(
'Attr.AllowedRel' => 'nofollow',
'Attr.AllowedRev' => 'index'
)
</span>', true
);
// invalid children

View File

@@ -7,6 +7,8 @@ class HTMLPurifier_HTMLModule_ImageTest extends HTMLPurifier_HTMLModuleHarness
function test() {
$this->setupScaffold('Image');
// max
$this->assertResult(
'<span>
@@ -16,6 +18,7 @@ class HTMLPurifier_HTMLModule_ImageTest extends HTMLPurifier_HTMLModuleHarness
longdesc="example.description.txt"
height="42"
width="42"
ac:common="yes"
/>
</span>'
);

View File

@@ -7,12 +7,14 @@ class HTMLPurifier_HTMLModule_LegacyTest extends HTMLPurifier_HTMLModuleHarness
function test() {
$this->setupScaffold('Legacy');
// max
$this->assertResult(
'<span>
<u>Text<span></span></u>
<s>Text<span></span></s>
<strike>Text<span></span></strike>
<u ac:common="yes">Text<span></span></u>
<s ac:common="yes">Text<span></span></s>
<strike ac:common="yes">Text<span></span></strike>
</span>'
);