mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
Implement simple attribute transformations and roll them out.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@152 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -23,6 +23,14 @@ class HTMLPurifier_AttrDef_EnumTest extends UnitTestCase
|
||||
|
||||
}
|
||||
|
||||
function testFixing() {
|
||||
|
||||
$def = new HTMLPurifier_AttrDef_Enum(array('one'));
|
||||
|
||||
$this->assertEqual('one', $def->validate(' one '));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -26,6 +26,9 @@ class HTMLPurifier_AttrDef_IDTest extends UnitTestCase
|
||||
// test duplicate detection
|
||||
$this->assertFalse($def->validate('a' , $acc));
|
||||
|
||||
// valid once whitespace stripped, but needs to be amended
|
||||
$this->assertEqual('whee', $def->validate(' whee ', $acc));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -34,6 +34,10 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends
|
||||
$inputs[5] = '<div ID="valid">Convert ID to lowercase.</div>';
|
||||
$expect[5] = '<div id="valid">Convert ID to lowercase.</div>';
|
||||
|
||||
// test simple attribute substitution
|
||||
$inputs[6] = '<div id=" valid ">Trim whitespace.</div>';
|
||||
$expect[6] = '<div id="valid">Trim whitespace.</div>';
|
||||
|
||||
$this->assertStrategyWorks($strategy, $inputs, $expect);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user