3 class HTMLPurifier_Injector_RemoveSpansWithoutAttributesTest
extends HTMLPurifier_InjectorHarness
5 public function setup()
8 $this->config
->set('HTML.Allowed', 'span[class],div,p,strong,em');
9 $this->config
->set('AutoFormat.RemoveSpansWithoutAttributes', true);
12 public function testSingleSpan()
20 public function testSingleSpanWithAttributes()
23 '<span class="bar">foo</span>',
24 '<span class="bar">foo</span>'
28 public function testSingleNestedSpan()
31 '<p><span>foo</span></p>',
36 public function testSingleNestedSpanWithAttributes()
39 '<p><span class="bar">foo</span></p>',
40 '<p><span class="bar">foo</span></p>'
45 public function testSpanWithChildren()
48 '<span>foo <strong>bar</strong> <em>baz</em></span>',
49 'foo <strong>bar</strong> <em>baz</em>'
53 public function testSpanWithSiblings()
56 '<p>before <span>inside</span> <strong>after</strong></p>',
57 '<p>before inside <strong>after</strong></p>'
61 public function testNestedSpanWithSiblingsAndChildren()
64 '<p>a <span>b <em>c</em> d</span> e</p>',
65 '<p>a b <em>c</em> d e</p>'
69 public function testNestedSpansWithoutAttributes()
72 '<span>one<span>two<span>three</span></span></span>',
77 public function testDeeplyNestedSpan()
80 '<div><div><div><span class="a">a <span>b</span> c</span></div></div></div>',
81 '<div><div><div><span class="a">a b c</span></div></div></div>'
85 public function testSpanWithInvalidAttributes()
88 '<p><span snorkel buzzer="emu">foo</span></p>',
93 public function testNestedAlternateSpans()
96 '<span>a <span class="x">b <span>c <span class="y">d <span>e <span class="z">f
97 </span></span></span></span></span></span>',
98 'a <span class="x">b c <span class="y">d e <span class="z">f
99 </span></span></span>'
103 public function testSpanWithSomeInvalidAttributes()
106 '<p><span buzzer="emu" class="bar">foo</span></p>',
107 '<p><span class="bar">foo</span></p>'
112 // vim: et sw=4 sts=4