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.

46 lines
1.1KB

  1. <?php
  2. class HTMLPurifier_AttrTransform_BackgroundTest extends HTMLPurifier_AttrTransformHarness
  3. {
  4. public function setUp()
  5. {
  6. parent::setUp();
  7. $this->obj = new HTMLPurifier_AttrTransform_Background();
  8. }
  9. public function testEmptyInput()
  10. {
  11. $this->assertResult( array() );
  12. }
  13. public function testBasicTransform()
  14. {
  15. $this->assertResult(
  16. array('background' => 'logo.png'),
  17. array('style' => 'background-image:url(logo.png);')
  18. );
  19. }
  20. public function testPrependNewCSS()
  21. {
  22. $this->assertResult(
  23. array('background' => 'logo.png', 'style' => 'font-weight:bold'),
  24. array('style' => 'background-image:url(logo.png);font-weight:bold')
  25. );
  26. }
  27. public function testLenientTreatmentOfInvalidInput()
  28. {
  29. // notice that we rely on the CSS validator later to fix this invalid
  30. // stuff
  31. $this->assertResult(
  32. array('background' => 'logo.png);foo:('),
  33. array('style' => 'background-image:url(logo.png);foo:();')
  34. );
  35. }
  36. }
  37. // vim: et sw=4 sts=4