mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-10 01:06:20 +02:00
[1.7.0] Implement addAttribute() of advanced API.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1164 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@ -52,6 +52,23 @@ class HTMLPurifier_HTMLDefinitionTest extends UnitTestCase
|
||||
|
||||
}
|
||||
|
||||
function test_addAttribute() {
|
||||
|
||||
$config = HTMLPurifier_Config::create(array(
|
||||
'HTML.DefinitionID' => 'HTMLPurifier_HTMLDefinitionTest->test_addAttribute'
|
||||
));
|
||||
$config->revision = 9;
|
||||
$def =& $config->getHTMLDefinition(true);
|
||||
$def->addAttribute('span', 'custom', 'Enum#attribute');
|
||||
$def = $config->getHTMLDefinition();
|
||||
|
||||
$purifier = new HTMLPurifier($config);
|
||||
$input = '<span custom="attribute">Custom!</span>';
|
||||
$output = $purifier->purify($input);
|
||||
$this->assertIdentical($input, $output);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user