2006-11-22 18:55:15 +00:00
|
|
|
<?php
|
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
// we're using empty tags to compact the tests: under real circumstances
|
|
|
|
// there would be contents in them
|
|
|
|
|
2006-11-22 18:55:15 +00:00
|
|
|
class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-06 06:22:23 +00:00
|
|
|
function setUp() {
|
|
|
|
parent::setUp();
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->obj = new HTMLPurifier_ChildDef_Table();
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testEmptyInput() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('', false);
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testSingleRow() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('<tr />');
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testComplexContents() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('<caption /><col /><thead /><tfoot /><tbody>'.
|
|
|
|
'<tr><td>asdf</td></tr></tbody>');
|
|
|
|
$this->assertResult('<col /><col /><col /><tr />');
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testReorderContents() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<col /><colgroup /><tbody /><tfoot /><thead /><tr>1</tr><caption /><tr />',
|
|
|
|
'<caption /><col /><colgroup /><thead /><tfoot /><tbody /><tr>1</tr><tr />');
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testDuplicateProcessing() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<caption>1</caption><caption /><tbody /><tbody /><tfoot>1</tfoot><tfoot />',
|
|
|
|
'<caption>1</caption><tfoot>1</tfoot><tbody /><tbody /><tbody />'
|
|
|
|
);
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testRemoveText() {
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult('foo', false);
|
2007-08-07 05:38:22 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testStickyWhitespaceOnTr() {
|
|
|
|
$this->config->set('Output', 'Newline', "\n");
|
|
|
|
$this->assertResult("\n <tr />\n <tr />\n ");
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-08-07 05:38:22 +00:00
|
|
|
function testStickyWhitespaceOnTSection() {
|
|
|
|
$this->config->set('Output', 'Newline', "\n");
|
2006-11-22 18:55:15 +00:00
|
|
|
$this->assertResult(
|
|
|
|
"\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
|
2007-08-07 05:38:22 +00:00
|
|
|
"\n\t\t<tfoot />\n\t<tbody />\n\t\t\t"
|
2006-11-22 18:55:15 +00:00
|
|
|
);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-11-22 18:55:15 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-11-22 18:55:15 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|