AlphaValueTest.php 574 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class HTMLPurifier_AttrDef_CSS_AlphaValueTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. function test() {
  5. $this->def = new HTMLPurifier_AttrDef_CSS_AlphaValue();
  6. $this->assertDef('0');
  7. $this->assertDef('1');
  8. $this->assertDef('.2');
  9. // clamping to [0.0, 1,0]
  10. $this->assertDef('1.2', '1');
  11. $this->assertDef('-3', '0');
  12. $this->assertDef('0.0', '0');
  13. $this->assertDef('1.0', '1');
  14. $this->assertDef('000', '0');
  15. $this->assertDef('asdf', false);
  16. }
  17. }
  18. // vim: et sw=4 sts=4