LengthTest.php 651 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class HTMLPurifier_AttrDef_HTML_LengthTest extends HTMLPurifier_AttrDef_HTML_PixelsTest
  3. {
  4. function setup() {
  5. $this->def = new HTMLPurifier_AttrDef_HTML_Length();
  6. }
  7. function test() {
  8. // pixel check
  9. parent::test();
  10. // percent check
  11. $this->assertDef('25%');
  12. // Firefox maintains percent, so will we
  13. $this->assertDef('0%');
  14. // 0% <= percent <= 100%
  15. $this->assertDef('-15%', '0%');
  16. $this->assertDef('120%', '100%');
  17. // fractional percents, apparently, aren't allowed
  18. $this->assertDef('56.5%', '56%');
  19. }
  20. }
  21. // vim: et sw=4 sts=4