mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Add CSSLength support, and roll out to all applicable styles.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@237 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
40
tests/HTMLPurifier/AttrDef/CSSLengthTest.php
Normal file
40
tests/HTMLPurifier/AttrDef/CSSLengthTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/CSSLength.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_CSSLengthTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_CSSLength();
|
||||
|
||||
$this->assertDef('0');
|
||||
$this->assertDef('0px');
|
||||
$this->assertDef('4.5px');
|
||||
$this->assertDef('-4.5px');
|
||||
$this->assertDef('3ex');
|
||||
$this->assertDef('3em');
|
||||
$this->assertDef('3in');
|
||||
$this->assertDef('3cm');
|
||||
$this->assertDef('3mm');
|
||||
$this->assertDef('3pt');
|
||||
$this->assertDef('3pc');
|
||||
|
||||
$this->assertDef('3', false);
|
||||
$this->assertDef('3miles', false);
|
||||
|
||||
}
|
||||
|
||||
function testNonNegative() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_CSSLength(true);
|
||||
|
||||
$this->assertDef('3cm');
|
||||
$this->assertDef('-3mm', false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -24,6 +24,13 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('background-color:transparent;');
|
||||
$this->assertDef('color:#F00;');
|
||||
$this->assertDef('border-top-color:#F00;');
|
||||
$this->assertDef('border-top-width:thin;');
|
||||
$this->assertDef('border-top-width:12px;');
|
||||
$this->assertDef('border-top-width:-12px;', false);
|
||||
$this->assertDef('letter-spacing:normal;');
|
||||
$this->assertDef('letter-spacing:2px;');
|
||||
$this->assertDef('word-spacing:normal;');
|
||||
$this->assertDef('word-spacing:3em;');
|
||||
|
||||
// duplicates
|
||||
$this->assertDef('text-align:right;text-align:left;',
|
||||
|
@@ -26,6 +26,14 @@ class HTMLPurifier_AttrDef_NumberTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
}
|
||||
|
||||
function testNonNegative() {
|
||||
|
||||
$this->def = new HTMLPurifier_AttrDef_Number(true);
|
||||
$this->assertDef('23');
|
||||
$this->assertDef('-12', false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user