Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

87 rindas
2.3KB

  1. <?php
  2. // we're using empty tags to compact the tests: under real circumstances
  3. // there would be contents in them
  4. class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness
  5. {
  6. public function setUp()
  7. {
  8. parent::setUp();
  9. $this->obj = new HTMLPurifier_ChildDef_Table();
  10. }
  11. public function testEmptyInput()
  12. {
  13. $this->assertResult('', false);
  14. }
  15. public function testSingleRow()
  16. {
  17. $this->assertResult('<tr />');
  18. }
  19. public function testComplexContents()
  20. {
  21. $this->assertResult('<caption /><col /><thead /><tfoot /><tbody>'.
  22. '<tr><td>asdf</td></tr></tbody>');
  23. $this->assertResult('<col /><col /><col /><tr />');
  24. }
  25. public function testReorderContents()
  26. {
  27. $this->assertResult(
  28. '<col /><colgroup /><tbody /><tfoot /><thead /><tr>1</tr><caption /><tr />',
  29. '<caption /><col /><colgroup /><thead /><tfoot /><tbody /><tbody><tr>1</tr><tr /></tbody>');
  30. }
  31. public function testXhtml11Illegal()
  32. {
  33. $this->assertResult(
  34. '<thead><tr><th>a</th></tr></thead><tr><td>a</td></tr>',
  35. '<thead><tr><th>a</th></tr></thead><tbody><tr><td>a</td></tr></tbody>'
  36. );
  37. }
  38. public function testTrOverflowAndClose()
  39. {
  40. $this->assertResult(
  41. '<tr><td>a</td></tr><tr><td>b</td></tr><tbody><tr><td>c</td></tr></tbody><tr><td>d</td></tr>',
  42. '<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>'
  43. );
  44. }
  45. public function testDuplicateProcessing()
  46. {
  47. $this->assertResult(
  48. '<caption>1</caption><caption /><tbody /><tbody /><tfoot>1</tfoot><tfoot />',
  49. '<caption>1</caption><tfoot>1</tfoot><tbody /><tbody /><tbody />'
  50. );
  51. }
  52. public function testRemoveText()
  53. {
  54. $this->assertResult('foo', false);
  55. }
  56. public function testStickyWhitespaceOnTr()
  57. {
  58. $this->config->set('Output.Newline', "\n");
  59. $this->assertResult("\n <tr />\n <tr />\n ");
  60. }
  61. public function testStickyWhitespaceOnTSection()
  62. {
  63. $this->config->set('Output.Newline', "\n");
  64. $this->assertResult(
  65. "\n\t<tbody />\n\t\t<tfoot />\n\t\t\t",
  66. "\n\t<tfoot />\n\t\t\t<tbody />\n\t\t"
  67. );
  68. }
  69. }
  70. // vim: et sw=4 sts=4