PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / tests / HTMLPurifier / Injector / RemoveSpansWithoutAttributesTest.php
blob841b0351f7d609a9a3271e0ed1c8430b76bafac5
1 <?php
3 class HTMLPurifier_Injector_RemoveSpansWithoutAttributesTest extends HTMLPurifier_InjectorHarness
5 public function setup()
7 parent::setup();
8 $this->config->set('HTML.Allowed', 'span[class],div,p,strong,em');
9 $this->config->set('AutoFormat.RemoveSpansWithoutAttributes', true);
12 public function testSingleSpan()
14 $this->assertResult(
15 '<span>foo</span>',
16 'foo'
20 public function testSingleSpanWithAttributes()
22 $this->assertResult(
23 '<span class="bar">foo</span>',
24 '<span class="bar">foo</span>'
28 public function testSingleNestedSpan()
30 $this->assertResult(
31 '<p><span>foo</span></p>',
32 '<p>foo</p>'
36 public function testSingleNestedSpanWithAttributes()
38 $this->assertResult(
39 '<p><span class="bar">foo</span></p>',
40 '<p><span class="bar">foo</span></p>'
45 public function testSpanWithChildren()
47 $this->assertResult(
48 '<span>foo <strong>bar</strong> <em>baz</em></span>',
49 'foo <strong>bar</strong> <em>baz</em>'
53 public function testSpanWithSiblings()
55 $this->assertResult(
56 '<p>before <span>inside</span> <strong>after</strong></p>',
57 '<p>before inside <strong>after</strong></p>'
61 public function testNestedSpanWithSiblingsAndChildren()
63 $this->assertResult(
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()
71 $this->assertResult(
72 '<span>one<span>two<span>three</span></span></span>',
73 'onetwothree'
77 public function testDeeplyNestedSpan()
79 $this->assertResult(
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()
87 $this->assertResult(
88 '<p><span snorkel buzzer="emu">foo</span></p>',
89 '<p>foo</p>'
93 public function testNestedAlternateSpans()
95 $this->assertResult(
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()
105 $this->assertResult(
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