Bump minor version number to 4.4.0.
[htmlpurifier.git] / tests / HTMLPurifier / ChildDef / TableTest.php
blob2f72d187a435cc94ecea322847f8a4fa5724a8c7
1 <?php
3 // we're using empty tags to compact the tests: under real circumstances
4 // there would be contents in them
6 class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
9 function setUp() {
10 parent::setUp();
11 $this->obj = new HTMLPurifier_ChildDef_Table();
14 function testEmptyInput() {
15 $this->assertResult('', false);
18 function testSingleRow() {
19 $this->assertResult('<tr />');
22 function testComplexContents() {
23 $this->assertResult('<caption /><col /><thead /><tfoot /><tbody>'.
24 '<tr><td>asdf</td></tr></tbody>');
25 $this->assertResult('<col /><col /><col /><tr />');
28 function testReorderContents() {
29 $this->assertResult(
30 '<col /><colgroup /><tbody /><tfoot /><thead /><tr>1</tr><caption /><tr />',
31 '<caption /><col /><colgroup /><thead /><tfoot /><tbody /><tbody><tr>1</tr><tr /></tbody>');
34 function testXhtml11Illegal() {
35 $this->assertResult(
36 '<thead><tr><th>a</th></tr></thead><tr><td>a</td></tr>',
37 '<thead><tr><th>a</th></tr></thead><tbody><tr><td>a</td></tr></tbody>'
41 function testTrOverflowAndClose() {
42 $this->assertResult(
43 '<tr><td>a</td></tr><tr><td>b</td></tr><tbody><tr><td>c</td></tr></tbody><tr><td>d</td></tr>',
44 '<tbody><tr><td>a</td></tr><tr><td>b</td></tr></tbody><tbody><tr><td>c</td></tr></tbody><tbody><tr><td>d</td></tr></tbody>'
48 function testDuplicateProcessing() {
49 $this->assertResult(
50 '<caption>1</caption><caption /><tbody /><tbody /><tfoot>1</tfoot><tfoot />',
51 '<caption>1</caption><tfoot>1</tfoot><tbody /><tbody /><tbody />'
55 function testRemoveText() {
56 $this->assertResult('foo', false);
59 function testStickyWhitespaceOnTr() {
60 $this->config->set('Output.Newline', "\n");
61 $this->assertResult("\n <tr />\n <tr />\n ");
64 function testStickyWhitespaceOnTSection() {
65 $this->config->set('Output.Newline', "\n");
66 $this->assertResult(
67 "\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
68 "\n\t\t<tfoot />\n\t<tbody />\n\t\t\t"
75 // vim: et sw=4 sts=4