mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
[1.7.0] Add more convenience functions to HTMLModule, wire Edit and Hypertext to use new functionality
- Added LanguageCode to AttrTypes. We should prefer string representations of attribute definitions. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1040 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -45,6 +45,56 @@ class HTMLPurifier_HTMLModuleTest extends UnitTestCase
|
||||
|
||||
}
|
||||
|
||||
function test_parseContents() {
|
||||
|
||||
$module = new HTMLPurifier_HTMLModule();
|
||||
|
||||
// pre-defined templates
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('Inline'),
|
||||
array('optional', 'Inline | #PCDATA')
|
||||
);
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('Flow'),
|
||||
array('optional', 'Flow | #PCDATA')
|
||||
);
|
||||
|
||||
// normalization procedures
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('optional: a'),
|
||||
array('optional', 'a')
|
||||
);
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('OPTIONAL :a'),
|
||||
array('optional', 'a')
|
||||
);
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('Optional: a'),
|
||||
array('optional', 'a')
|
||||
);
|
||||
|
||||
// others
|
||||
$this->assertIdentical(
|
||||
$module->parseContents('Optional: a | b | c'),
|
||||
array('optional', 'a | b | c')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function test_mergeInAttrIncludes() {
|
||||
|
||||
$module = new HTMLPurifier_HTMLModule();
|
||||
|
||||
$attr = array();
|
||||
$module->mergeInAttrIncludes($attr, 'Common');
|
||||
$this->assertIdentical($attr, array(0 => array('Common')));
|
||||
|
||||
$attr = array('a' => 'b');
|
||||
$module->mergeInAttrIncludes($attr, array('Common', 'Good'));
|
||||
$this->assertIdentical($attr, array('a' => 'b', 0 => array('Common', 'Good')));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user