2006-08-12 20:22:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrDef/CSS.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
|
|
|
{
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
|
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS();
|
|
|
|
|
2006-08-13 16:52:31 +00:00
|
|
|
// regular cases, singular
|
2006-08-12 20:22:09 +00:00
|
|
|
$this->assertDef('text-align:right;');
|
2006-08-13 19:08:14 +00:00
|
|
|
$this->assertDef('border-left-style:solid;');
|
2006-08-13 16:52:31 +00:00
|
|
|
$this->assertDef('clear:right;');
|
|
|
|
$this->assertDef('float:left;');
|
|
|
|
$this->assertDef('font-style:italic;');
|
|
|
|
$this->assertDef('font-variant:small-caps;');
|
|
|
|
$this->assertDef('font-weight:bold;');
|
|
|
|
$this->assertDef('list-style-position:outside;');
|
|
|
|
$this->assertDef('list-style-type:upper-roman;');
|
|
|
|
$this->assertDef('text-transform:capitalize;');
|
2006-08-13 21:23:57 +00:00
|
|
|
$this->assertDef('background-color:rgb(0,0,255);');
|
|
|
|
$this->assertDef('background-color:transparent;');
|
|
|
|
$this->assertDef('color:#F00;');
|
|
|
|
$this->assertDef('border-top-color:#F00;');
|
2006-08-13 23:08:38 +00:00
|
|
|
$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;');
|
2006-08-14 02:08:45 +00:00
|
|
|
$this->assertDef('font-size:200%;');
|
|
|
|
$this->assertDef('font-size:larger;');
|
|
|
|
$this->assertDef('font-size:12pt;');
|
2006-08-13 16:52:31 +00:00
|
|
|
|
|
|
|
// duplicates
|
2006-08-13 17:05:30 +00:00
|
|
|
$this->assertDef('text-align:right;text-align:left;',
|
|
|
|
'text-align:left;');
|
2006-08-12 20:22:09 +00:00
|
|
|
|
2006-08-13 16:52:31 +00:00
|
|
|
// a few composites
|
|
|
|
$this->assertDef('font-variant:small-caps;font-weight:900;');
|
|
|
|
$this->assertDef('float:right;text-align:right;');
|
|
|
|
|
|
|
|
// selective removal
|
2006-08-13 17:05:30 +00:00
|
|
|
$this->assertDef('text-transform:capitalize;destroy:it;',
|
|
|
|
'text-transform:capitalize;');
|
2006-08-13 16:52:31 +00:00
|
|
|
|
|
|
|
// inherit works for everything
|
|
|
|
$this->assertDef('text-align:inherit;');
|
|
|
|
|
|
|
|
// bad props
|
|
|
|
$this->assertDef('nodice:foobar;', false);
|
|
|
|
$this->assertDef('position:absolute;', false);
|
|
|
|
$this->assertDef('background-image:url(javascript:alert\(\));', false);
|
|
|
|
|
2006-08-12 20:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|