0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-02 21:01:52 +00:00

Finalize fixNesting test suite.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@55 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-07-18 23:17:41 +00:00
parent 06798e60f2
commit 5391195170

View File

@ -375,8 +375,9 @@ class Test_PureHTMLDefinition extends UnitTestCase
$inputs = array();
$expect = array();
// some legal nestings
// next id = 4
// legal inline nesting
$inputs[0] = array(
new MF_StartTag('b'),
new MF_Text('Bold text'),
@ -384,7 +385,7 @@ class Test_PureHTMLDefinition extends UnitTestCase
);
$expect[0] = $inputs[0];
// test acceptance of inline and block
// legal inline and block
// as the parent element is considered FLOW
$inputs[1] = array(
new MF_StartTag('a', array('href' => 'http://www.example.com/')),
@ -396,7 +397,7 @@ class Test_PureHTMLDefinition extends UnitTestCase
);
$expect[1] = $inputs[1];
// test illegal block element -> text
// illegal block in inline, element -> text
$inputs[2] = array(
new MF_StartTag('b'),
new MF_StartTag('div'),
@ -412,6 +413,18 @@ class Test_PureHTMLDefinition extends UnitTestCase
new MF_EndTag('b'),
);
// illegal <a> in <a>
$inputs[3] = array(
new MF_StartTag('a'),
new MF_EndTag('a')
);
$expect[3] = array(
new MF_StartTag('a'),
new MF_EndTag('a')
);
foreach ($inputs as $i => $input) {
$result = $this->def->fixNesting($input);
$this->assertEqual($expect[$i], $result);