Support for inline-block.
[htmlpurifier.git] / tests / HTMLPurifier / Injector / RemoveSpansWithoutAttributesTest.php
blob704c1cd7b79eb5c9a22834000387874e70e37837
1 <?php
3 class HTMLPurifier_Injector_RemoveSpansWithoutAttributesTest extends HTMLPurifier_InjectorHarness
5 function setup() {
6 parent::setup();
7 $this->config->set('HTML.Allowed', 'span[class],div,p,strong,em');
8 $this->config->set('AutoFormat.RemoveSpansWithoutAttributes', true);
11 function testSingleSpan() {
12 $this->assertResult(
13 '<span>foo</span>',
14 'foo'
18 function testSingleSpanWithAttributes() {
19 $this->assertResult(
20 '<span class="bar">foo</span>',
21 '<span class="bar">foo</span>'
25 function testSingleNestedSpan() {
26 $this->assertResult(
27 '<p><span>foo</span></p>',
28 '<p>foo</p>'
32 function testSingleNestedSpanWithAttributes() {
33 $this->assertResult(
34 '<p><span class="bar">foo</span></p>',
35 '<p><span class="bar">foo</span></p>'
40 function testSpanWithChildren() {
41 $this->assertResult(
42 '<span>foo <strong>bar</strong> <em>baz</em></span>',
43 'foo <strong>bar</strong> <em>baz</em>'
47 function testSpanWithSiblings() {
48 $this->assertResult(
49 '<p>before <span>inside</span> <strong>after</strong></p>',
50 '<p>before inside <strong>after</strong></p>'
54 function testNestedSpanWithSiblingsAndChildren() {
55 $this->assertResult(
56 '<p>a <span>b <em>c</em> d</span> e</p>',
57 '<p>a b <em>c</em> d e</p>'
61 function testNestedSpansWithoutAttributes() {
62 $this->assertResult(
63 '<span>one<span>two<span>three</span></span></span>',
64 'onetwothree'
68 function testDeeplyNestedSpan() {
69 $this->assertResult(
70 '<div><div><div><span class="a">a <span>b</span> c</span></div></div></div>',
71 '<div><div><div><span class="a">a b c</span></div></div></div>'
75 function testSpanWithInvalidAttributes() {
76 $this->assertResult(
77 '<p><span snorkel buzzer="emu">foo</span></p>',
78 '<p>foo</p>'
82 function testNestedAlternateSpans() {
83 $this->assertResult(
84 '<span>a <span class="x">b <span>c <span class="y">d <span>e <span class="z">f
85 </span></span></span></span></span></span>',
86 'a <span class="x">b c <span class="y">d e <span class="z">f
87 </span></span></span>'
91 function testSpanWithSomeInvalidAttributes() {
92 $this->assertResult(
93 '<p><span buzzer="emu" class="bar">foo</span></p>',
94 '<p><span class="bar">foo</span></p>'
99 // vim: et sw=4 sts=4