1
0
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:
Edward Z. Yang
2006-05-30 22:44:14 +00:00
parent 3f123d6f53
commit f5486bbbae
2 changed files with 44 additions and 7 deletions

View File

@@ -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));
}
}
?>