1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 14:16:32 +02:00

Add support for proprietary "background" attribute in table elements.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-09-27 21:19:35 -04:00
parent 6a06b92f0c
commit d0fdcc103e
7 changed files with 78 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
<?php
class HTMLPurifier_AttrTransform_BackgroundTest extends HTMLPurifier_AttrTransformHarness
{
function setUp() {
parent::setUp();
$this->obj = new HTMLPurifier_AttrTransform_Background();
}
function testEmptyInput() {
$this->assertResult( array() );
}
function testBasicTransform() {
$this->assertResult(
array('background' => 'logo.png'),
array('style' => 'background-image:url(logo.png);')
);
}
function testPrependNewCSS() {
$this->assertResult(
array('background' => 'logo.png', 'style' => 'font-weight:bold'),
array('style' => 'background-image:url(logo.png);font-weight:bold')
);
}
function testLenientTreatmentOfInvalidInput() {
// notice that we rely on the CSS validator later to fix this invalid
// stuff
$this->assertResult(
array('background' => 'logo.png);foo:('),
array('style' => 'background-image:url(logo.png);foo:();')
);
}
}