2006-08-13 23:08:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrDef/CSSLength.php';
|
2007-01-19 23:02:28 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDefHarness.php';
|
2006-08-13 23:08:38 +00:00
|
|
|
|
|
|
|
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');
|
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('3PX', '3px');
|
|
|
|
|
2006-08-13 23:08:38 +00:00
|
|
|
$this->assertDef('3', false);
|
|
|
|
$this->assertDef('3miles', false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testNonNegative() {
|
|
|
|
|
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSSLength(true);
|
|
|
|
|
|
|
|
$this->assertDef('3cm');
|
|
|
|
$this->assertDef('-3mm', false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|