You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1KB

  1. <?php
  2. class HTMLPurifier_AttrDef_CSS_LengthTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. public function test()
  5. {
  6. $this->def = new HTMLPurifier_AttrDef_CSS_Length();
  7. $this->assertDef('0');
  8. $this->assertDef('0px');
  9. $this->assertDef('4.5px');
  10. $this->assertDef('-4.5px');
  11. $this->assertDef('3ex');
  12. $this->assertDef('3em');
  13. $this->assertDef('3in');
  14. $this->assertDef('3cm');
  15. $this->assertDef('3mm');
  16. $this->assertDef('3pt');
  17. $this->assertDef('3pc');
  18. $this->assertDef('3PX', '3px');
  19. $this->assertDef('3', false);
  20. $this->assertDef('3miles', false);
  21. }
  22. public function testNonNegative()
  23. {
  24. $this->def = new HTMLPurifier_AttrDef_CSS_Length('0');
  25. $this->assertDef('3cm');
  26. $this->assertDef('-3mm', false);
  27. }
  28. public function testBounding()
  29. {
  30. $this->def = new HTMLPurifier_AttrDef_CSS_Length('-1in', '1in');
  31. $this->assertDef('1cm');
  32. $this->assertDef('-1cm');
  33. $this->assertDef('0');
  34. $this->assertDef('1em', false);
  35. }
  36. }
  37. // vim: et sw=4 sts=4