2007-12-16 23:16:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrDef_CSS_AlphaValueTest extends HTMLPurifier_AttrDefHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
function test() {
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_AlphaValue();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
$this->assertDef('0');
|
|
|
|
$this->assertDef('1');
|
|
|
|
$this->assertDef('.2');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
// clamping to [0.0, 1,0]
|
|
|
|
$this->assertDef('1.2', '1');
|
|
|
|
$this->assertDef('-3', '0');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
$this->assertDef('0.0', '0');
|
|
|
|
$this->assertDef('1.0', '1');
|
|
|
|
$this->assertDef('000', '0');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
$this->assertDef('asdf', false);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-12-16 23:16:45 +00:00
|
|
|
}
|
|
|
|
|