1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-10 16:14:08 +02:00

Fix bug in HTML_Generator that resulted in extra spaces. PureHTMLDefinition now passes all tests.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@34 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-04-16 03:33:37 +00:00
parent 2782d7499a
commit 69da034570
4 changed files with 33 additions and 3 deletions

View File

@@ -27,6 +27,9 @@ class UnitTest_HTML_Generator extends UnitTestCase
$inputs[3] = new MF_EmptyTag('br', array('style' => 'font-family:"Courier New";'));
$expect[3] = '<br style="font-family:&quot;Courier New&quot;;" />';
$inputs[4] = new MF_StartTag('asdf');
$expect[4] = '<asdf>';
foreach ($inputs as $i => $input) {
$result = $this->gen->generateFromToken($input);
$this->assertEqual($result, $expect[$i]);

View File

@@ -28,6 +28,29 @@ class UnitTest_PureHTMLDefinition extends UnitTestCase
);
$expect[1] = $inputs[1];
$inputs[2] = array(
new MF_StartTag('asdf')
,new MF_EndTag('asdf')
,new MF_StartTag('d', array('href' => 'bang!'))
,new MF_EndTag('d')
,new MF_StartTag('pooloka')
,new MF_StartTag('poolasdf')
,new MF_StartTag('ds', array('moogle' => '&'))
,new MF_EndTag('asdf')
,new MF_EndTag('asdf')
);
$expect[2] = array(
new MF_Text('<asdf>')
,new MF_Text('</asdf>')
,new MF_Text('<d href="bang!">')
,new MF_Text('</d>')
,new MF_Text('<pooloka>')
,new MF_Text('<poolasdf>')
,new MF_Text('<ds moogle="&amp;">')
,new MF_Text('</asdf>')
,new MF_Text('</asdf>')
);
foreach ($inputs as $i => $input) {
$result = $this->def->removeForeignElements($input);
$this->assertEqual($result, $expect[$i]);