mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 06:07:26 +02:00
- Fixed lots of bugs
- Defined new directive %Core.EscapeInvalidChildren, for previously commented out functionality - Removed convenience configuration generation: you *have* to pass it unless you're interfacing with HTMLPurifier - Homogenized function parameters even when only a few of them are used - Rewrote unit tests that expected previous behavior - Introduced configuration object to ChildDef tests git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@243 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -13,6 +13,10 @@ class HTMLPurifier_Strategy_FixNestingTest
|
||||
|
||||
$inputs = array();
|
||||
$expect = array();
|
||||
$config = array();
|
||||
|
||||
$config_escape = HTMLPurifier_Config::createDefault();
|
||||
$config_escape->set('Core', 'EscapeInvalidChildren', true);
|
||||
|
||||
// next id = 4
|
||||
|
||||
@@ -27,7 +31,12 @@ class HTMLPurifier_Strategy_FixNestingTest
|
||||
|
||||
// illegal block in inline, element -> text
|
||||
$inputs[2] = '<b><div>Illegal div.</div></b>';
|
||||
$expect[2] = '<b><div>Illegal div.</div></b>';
|
||||
$expect[2] = '<b></b>';
|
||||
|
||||
// same test with different configuration (fragile)
|
||||
$inputs[13] = '<b><div>Illegal div.</div></b>';
|
||||
$expect[13] = '<b><div>Illegal div.</div></b>';
|
||||
$config[13] = $config_escape;
|
||||
|
||||
// test of empty set that's required, resulting in removal of node
|
||||
$inputs[3] = '<ul></ul>';
|
||||
@@ -63,13 +72,20 @@ class HTMLPurifier_Strategy_FixNestingTest
|
||||
|
||||
// block in inline ins not allowed
|
||||
$inputs[11] = '<span><ins><div>Not allowed!</div></ins></span>';
|
||||
$expect[11] = '<span><ins><div>Not allowed!</div></ins></span>';
|
||||
$expect[11] = '<span><ins></ins></span>';
|
||||
|
||||
// block in inline ins not allowed
|
||||
$inputs[14] = '<span><ins><div>Not allowed!</div></ins></span>';
|
||||
$expect[14] = '<span><ins><div>Not allowed!</div></ins></span>';
|
||||
$config[14] = $config_escape;
|
||||
|
||||
// test exclusions
|
||||
$inputs[12] = '<a><span><a>Not allowed</a></span></a>';
|
||||
$expect[12] = '<a><span></span></a>';
|
||||
|
||||
$this->assertStrategyWorks($strategy, $inputs, $expect);
|
||||
// next test is *15*
|
||||
|
||||
$this->assertStrategyWorks($strategy, $inputs, $expect, $config);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user