mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 21:57:26 +02:00
Add ChildDef_Optional, which piggy-backs off of ChildDef_Required. Some column 80 formatting fixes.
git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@49 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -303,6 +303,28 @@ class Test_HTMLDTD_ChildDef extends UnitTestCase
|
||||
$this->assertEqual($expect, $def->validateChildren($input));
|
||||
}
|
||||
|
||||
function test_optional() {
|
||||
$def = new HTMLDTD_ChildDef_Optional('b | i');
|
||||
$input = array(
|
||||
new MF_StartTag('b')
|
||||
,new MF_Text('Bold text')
|
||||
,new MF_EndTag('b')
|
||||
,new MF_EmptyTag('img') // illegal tag
|
||||
);
|
||||
$expect = array(
|
||||
new MF_StartTag('b')
|
||||
,new MF_Text('Bold text')
|
||||
,new MF_EndTag('b')
|
||||
);
|
||||
$this->assertEqual($expect, $def->validateChildren($input));
|
||||
|
||||
$input = array(
|
||||
new MF_Text('Not allowed text')
|
||||
);
|
||||
$expect = array();
|
||||
$this->assertEqual($expect, $def->validateChildren($input));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user