mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
[1.6.1] Implement BoolToCSS attribute transformations for td,th.nowrap and hr.noshade
- Implement CSS property white-space:nowrap; - Update TODO with more ambitious goal: all transforms by 1.6.1 git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1012 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
39
tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php
Normal file
39
tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrTransform/BoolToCSS.php';
|
||||
require_once 'HTMLPurifier/AttrTransformHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrTransform_BoolToCSSTest extends HTMLPurifier_AttrTransformHarness
|
||||
{
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->obj = new HTMLPurifier_AttrTransform_BoolToCSS('foo', 'bar:3in;');
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
||||
$this->assertResult( array() );
|
||||
|
||||
$this->assertResult(
|
||||
array('foo' => 'foo'),
|
||||
array('style' => 'bar:3in;')
|
||||
);
|
||||
|
||||
// boolean attribute just has to be set: we don't care about
|
||||
// anything else
|
||||
$this->assertResult(
|
||||
array('foo' => 'no'),
|
||||
array('style' => 'bar:3in;')
|
||||
);
|
||||
|
||||
$this->assertResult(
|
||||
array('foo' => 'foo', 'style' => 'background-color:#F00;'),
|
||||
array('style' => 'bar:3in;background-color:#F00;')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -220,6 +220,16 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends
|
||||
'<hr size="3" />',
|
||||
'<hr style="height:3px;" />'
|
||||
);
|
||||
$this->assertResult(
|
||||
'<hr noshade />',
|
||||
'<hr style="border-style:solid;" />'
|
||||
);
|
||||
|
||||
// td boolean transformation
|
||||
$this->assertResult(
|
||||
'<td nowrap />',
|
||||
'<td style="white-space:nowrap;" />'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@ $test_files[] = 'AttrDef/URITest.php';
|
||||
$test_files[] = 'AttrDefTest.php';
|
||||
$test_files[] = 'AttrTransform/BdoDirTest.php';
|
||||
$test_files[] = 'AttrTransform/BgColorTest.php';
|
||||
$test_files[] = 'AttrTransform/BoolToCSSTest.php';
|
||||
$test_files[] = 'AttrTransform/BorderTest.php';
|
||||
$test_files[] = 'AttrTransform/ImgRequiredTest.php';
|
||||
$test_files[] = 'AttrTransform/ImgSpaceTest.php';
|
||||
|
Reference in New Issue
Block a user