2008-06-27 20:09:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_Injector_RemoveEmptyTest extends HTMLPurifier_InjectorHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
public function setup() {
|
|
|
|
parent::setup();
|
|
|
|
$this->config->set('AutoFormat', 'RemoveEmpty', true);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testPreserve() {
|
|
|
|
$this->assertResult('<b>asdf</b>');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemove() {
|
|
|
|
$this->assertResult('<b></b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveWithSpace() {
|
|
|
|
$this->assertResult('<b> </b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveWithAttr() {
|
|
|
|
$this->assertResult('<b class="asdf"></b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveIdAndName() {
|
|
|
|
$this->assertResult('<a id="asdf" name="asdf"></a>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testPreserveColgroup() {
|
|
|
|
$this->assertResult('<colgroup></colgroup>');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testPreserveId() {
|
|
|
|
$this->config->set('Attr', 'EnableID', true);
|
|
|
|
$this->assertResult('<a id="asdf"></a>');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testPreserveName() {
|
|
|
|
$this->config->set('Attr', 'EnableID', true);
|
|
|
|
$this->assertResult('<a name="asdf"></a>');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveNested() {
|
|
|
|
$this->assertResult('<b><i></i></b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveNested2() {
|
|
|
|
$this->assertResult('<b><i><u></u></i></b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
function testRemoveNested3() {
|
|
|
|
$this->assertResult('<b> <i> <u> </u> </i> </b>', '');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-27 20:09:14 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|