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.

52 lines
1.1KB

  1. <?php
  2. class HTMLPurifier_AttrTransform_LengthTest extends HTMLPurifier_AttrTransformHarness
  3. {
  4. public function setUp()
  5. {
  6. parent::setUp();
  7. $this->obj = new HTMLPurifier_AttrTransform_Length('width');
  8. }
  9. public function testEmptyInput()
  10. {
  11. $this->assertResult( array() );
  12. }
  13. public function testTransformPixel()
  14. {
  15. $this->assertResult(
  16. array('width' => '10'),
  17. array('style' => 'width:10px;')
  18. );
  19. }
  20. public function testTransformPercentage()
  21. {
  22. $this->assertResult(
  23. array('width' => '10%'),
  24. array('style' => 'width:10%;')
  25. );
  26. }
  27. public function testPrependNewCSS()
  28. {
  29. $this->assertResult(
  30. array('width' => '10%', 'style' => 'font-weight:bold'),
  31. array('style' => 'width:10%;font-weight:bold')
  32. );
  33. }
  34. public function testLenientTreatmentOfInvalidInput()
  35. {
  36. $this->assertResult(
  37. array('width' => 'asdf'),
  38. array('style' => 'width:asdf;')
  39. );
  40. }
  41. }
  42. // vim: et sw=4 sts=4