Fix two minor bugs, updating Phorum and removing unused $dir variable.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / Injector / RemoveEmptyTest.php
blob34dbc95154addece44a71c0f2fca38aadc8df4e2
1 <?php
3 class HTMLPurifier_Injector_RemoveEmptyTest extends HTMLPurifier_InjectorHarness
6 public function setup() {
7 parent::setup();
8 $this->config->set('AutoFormat.RemoveEmpty', true);
11 function testPreserve() {
12 $this->assertResult('<b>asdf</b>');
15 function testRemove() {
16 $this->assertResult('<b></b>', '');
19 function testRemoveWithSpace() {
20 $this->assertResult('<b> </b>', '');
23 function testRemoveWithAttr() {
24 $this->assertResult('<b class="asdf"></b>', '');
27 function testRemoveIdAndName() {
28 $this->assertResult('<a id="asdf" name="asdf"></a>', '');
31 function testPreserveColgroup() {
32 $this->assertResult('<colgroup></colgroup>');
35 function testPreserveId() {
36 $this->config->set('Attr.EnableID', true);
37 $this->assertResult('<a id="asdf"></a>');
40 function testPreserveName() {
41 $this->config->set('Attr.EnableID', true);
42 $this->assertResult('<a name="asdf"></a>');
45 function testRemoveNested() {
46 $this->assertResult('<b><i></i></b>', '');
49 function testRemoveNested2() {
50 $this->assertResult('<b><i><u></u></i></b>', '');
53 function testRemoveNested3() {
54 $this->assertResult('<b> <i> <u> </u> </i> </b>', '');
57 function testRemoveNbsp() {
58 $this->config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);
59 $this->assertResult('<b>&nbsp;</b>', '');
62 function testRemoveNbspMix() {
63 $this->config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);
64 $this->assertResult('<b>&nbsp; &nbsp;</b>', '');
67 function testDontRemoveNbsp() {
68 $this->config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);
69 $this->assertResult('<td>&nbsp;</b>', "<td>\xC2\xA0</td>");
72 function testRemoveNbspExceptionsSpecial() {
73 $this->config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);
74 $this->config->set('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions', 'b');
75 $this->assertResult('<b>&nbsp;</b>', "<b>\xC2\xA0</b>");
80 // vim: et sw=4 sts=4