選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

52 行
1.2KB

  1. <?php
  2. class HTMLPurifier_AttrDef_CSS_NumberTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. public function test()
  5. {
  6. $this->def = new HTMLPurifier_AttrDef_CSS_Number();
  7. $this->assertDef('0');
  8. $this->assertDef('0.0', '0');
  9. $this->assertDef('1.0', '1');
  10. $this->assertDef('34');
  11. $this->assertDef('4.5');
  12. $this->assertDef('.5');
  13. $this->assertDef('0.5', '.5');
  14. $this->assertDef('-56.9');
  15. $this->assertDef('0.', '0');
  16. $this->assertDef('.0', '0');
  17. $this->assertDef('0.0', '0');
  18. $this->assertDef('1.', '1');
  19. $this->assertDef('.1', '.1');
  20. $this->assertDef('1.0', '1');
  21. $this->assertDef('0.1', '.1');
  22. $this->assertDef('000', '0');
  23. $this->assertDef(' 9', '9');
  24. $this->assertDef('+5.0000', '5');
  25. $this->assertDef('02.20', '2.2');
  26. $this->assertDef('2.', '2');
  27. $this->assertDef('.', false);
  28. $this->assertDef('asdf', false);
  29. $this->assertDef('0.5.6', false);
  30. }
  31. public function testNonNegative()
  32. {
  33. $this->def = new HTMLPurifier_AttrDef_CSS_Number(true);
  34. $this->assertDef('23');
  35. $this->assertDef('-12', false);
  36. }
  37. }
  38. // vim: et sw=4 sts=4