ListTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. class HTMLPurifier_ChildDef_ListTest extends HTMLPurifier_ChildDefHarness
  3. {
  4. function setUp() {
  5. parent::setUp();
  6. $this->obj = new HTMLPurifier_ChildDef_List();
  7. }
  8. function testEmptyInput() {
  9. $this->assertResult('', false);
  10. }
  11. function testSingleLi() {
  12. $this->assertResult('<li />');
  13. }
  14. function testSomeLi() {
  15. $this->assertResult('<li>asdf</li><li />');
  16. }
  17. function testIllegal() {
  18. // XXX actually this never gets triggered in practice
  19. $this->assertResult('<li /><b />', '<li /><li><b /></li>');
  20. }
  21. function testOlAtBeginning() {
  22. $this->assertResult('<ol />', '<li><ol /></li>');
  23. }
  24. function testOlAtBeginningWithOtherJunk() {
  25. $this->assertResult('<ol /><li />', '<li><ol /></li><li />');
  26. }
  27. function testOlInMiddle() {
  28. $this->assertResult('<li>Foo</li><ol><li>Bar</li></ol>', '<li>Foo<ol><li>Bar</li></ol></li>');
  29. }
  30. function testMultipleOl() {
  31. $this->assertResult('<li /><ol /><ol />', '<li><ol /><ol /></li>');
  32. }
  33. function testUlAtBeginning() {
  34. $this->assertResult('<ul />', '<li><ul /></li>');
  35. }
  36. }
  37. // vim: et sw=4 sts=4