3 require_once 'HTMLPurifier/AttrDef/CSS.php';
5 class HTMLPurifier_AttrDef_CSSTest
extends HTMLPurifier_AttrDefHarness
10 $this->def
= new HTMLPurifier_AttrDef_CSS();
12 // regular cases, singular
13 $this->assertDef('text-align:right;');
14 $this->assertDef('border-left-style:solid;');
15 $this->assertDef('border-style:solid dotted;');
16 $this->assertDef('clear:right;');
17 $this->assertDef('float:left;');
18 $this->assertDef('font-style:italic;');
19 $this->assertDef('font-variant:small-caps;');
20 $this->assertDef('font-weight:bold;');
21 $this->assertDef('list-style-position:outside;');
22 $this->assertDef('list-style-type:upper-roman;');
23 $this->assertDef('text-transform:capitalize;');
24 $this->assertDef('background-color:rgb(0,0,255);');
25 $this->assertDef('background-color:transparent;');
26 $this->assertDef('color:#F00;');
27 $this->assertDef('border-top-color:#F00;');
28 $this->assertDef('border-color:#F00 #FF0;');
29 $this->assertDef('border-top-width:thin;');
30 $this->assertDef('border-top-width:12px;');
31 $this->assertDef('border-width:5px 1px 4px 2px;');
32 $this->assertDef('border-top-width:-12px;', false);
33 $this->assertDef('letter-spacing:normal;');
34 $this->assertDef('letter-spacing:2px;');
35 $this->assertDef('word-spacing:normal;');
36 $this->assertDef('word-spacing:3em;');
37 $this->assertDef('font-size:200%;');
38 $this->assertDef('font-size:larger;');
39 $this->assertDef('font-size:12pt;');
40 $this->assertDef('line-height:2;');
41 $this->assertDef('line-height:2em;');
42 $this->assertDef('line-height:20%;');
43 $this->assertDef('line-height:normal;');
44 $this->assertDef('line-height:-20%;', false);
45 $this->assertDef('margin-left:5px;');
46 $this->assertDef('margin-right:20%;');
47 $this->assertDef('margin-top:auto;');
48 $this->assertDef('margin:auto 5%;');
49 $this->assertDef('padding-bottom:5px;');
50 $this->assertDef('padding-top:20%;');
51 $this->assertDef('padding:20% 10%;');
52 $this->assertDef('padding-top:-20%;', false);
53 $this->assertDef('text-indent:3em;');
54 $this->assertDef('text-indent:5%;');
55 $this->assertDef('text-indent:-3em;');
56 $this->assertDef('width:50%;');
57 $this->assertDef('width:50px;');
58 $this->assertDef('width:auto;');
59 $this->assertDef('width:-50px;', false);
62 $this->assertDef('text-align:right;text-align:left;',
66 $this->assertDef('font-variant:small-caps;font-weight:900;');
67 $this->assertDef('float:right;text-align:right;');
70 $this->assertDef('text-transform:capitalize;destroy:it;',
71 'text-transform:capitalize;');
73 // inherit works for everything
74 $this->assertDef('text-align:inherit;');
77 $this->assertDef('nodice:foobar;', false);
78 $this->assertDef('position:absolute;', false);
79 $this->assertDef('background-image:url(javascript:alert\(\));', false);