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
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() {
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() {
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() {
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() {
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");
67 "\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
68 "\n\t\t<tfoot />\n\t<tbody />\n\t\t\t"