Implement list-style shorthand. Also, updated devnetwork.html with more recent threads.
[htmlpurifier.git] / tests / HTMLPurifier / AttrDef / CSSTest.php
blobad4ce7388513f5166d2af95db13ba607b1eaccbb
1 <?php
3 require_once 'HTMLPurifier/AttrDef/CSS.php';
5 class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
8 function test() {
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('list-style:upper-roman inside;');
24 $this->assertDef('text-transform:capitalize;');
25 $this->assertDef('background-color:rgb(0,0,255);');
26 $this->assertDef('background-color:transparent;');
27 $this->assertDef('background:#FF9;');
28 $this->assertDef('color:#F00;');
29 $this->assertDef('border-top-color:#F00;');
30 $this->assertDef('border-color:#F00 #FF0;');
31 $this->assertDef('border-top-width:thin;');
32 $this->assertDef('border-top-width:12px;');
33 $this->assertDef('border-width:5px 1px 4px 2px;');
34 $this->assertDef('border-top-width:-12px;', false);
35 $this->assertDef('letter-spacing:normal;');
36 $this->assertDef('letter-spacing:2px;');
37 $this->assertDef('word-spacing:normal;');
38 $this->assertDef('word-spacing:3em;');
39 $this->assertDef('font-size:200%;');
40 $this->assertDef('font-size:larger;');
41 $this->assertDef('font-size:12pt;');
42 $this->assertDef('line-height:2;');
43 $this->assertDef('line-height:2em;');
44 $this->assertDef('line-height:20%;');
45 $this->assertDef('line-height:normal;');
46 $this->assertDef('line-height:-20%;', false);
47 $this->assertDef('margin-left:5px;');
48 $this->assertDef('margin-right:20%;');
49 $this->assertDef('margin-top:auto;');
50 $this->assertDef('margin:auto 5%;');
51 $this->assertDef('padding-bottom:5px;');
52 $this->assertDef('padding-top:20%;');
53 $this->assertDef('padding:20% 10%;');
54 $this->assertDef('padding-top:-20%;', false);
55 $this->assertDef('text-indent:3em;');
56 $this->assertDef('text-indent:5%;');
57 $this->assertDef('text-indent:-3em;');
58 $this->assertDef('width:50%;');
59 $this->assertDef('width:50px;');
60 $this->assertDef('width:auto;');
61 $this->assertDef('width:-50px;', false);
62 $this->assertDef('text-decoration:underline;');
63 $this->assertDef('font-family:sans-serif;');
64 $this->assertDef('font-family:Gill, \'Times New Roman\', sans-serif;');
65 $this->assertDef('font:12px serif;');
66 $this->assertDef('border:1px solid #000;');
67 $this->assertDef('border-bottom:2em double #FF00FA;');
68 $this->assertDef('border-collapse:collapse;');
69 $this->assertDef('caption-side:top;');
70 $this->assertDef('vertical-align:middle;');
71 $this->assertDef('vertical-align:12px;');
72 $this->assertDef('vertical-align:50%;');
73 $this->assertDef('table-layout:fixed;');
75 // duplicates
76 $this->assertDef('text-align:right;text-align:left;',
77 'text-align:left;');
79 // a few composites
80 $this->assertDef('font-variant:small-caps;font-weight:900;');
81 $this->assertDef('float:right;text-align:right;');
83 // selective removal
84 $this->assertDef('text-transform:capitalize;destroy:it;',
85 'text-transform:capitalize;');
87 // inherit works for everything
88 $this->assertDef('text-align:inherit;');
90 // bad props
91 $this->assertDef('nodice:foobar;', false);
92 $this->assertDef('position:absolute;', false);
93 $this->assertDef('background-image:url(javascript:alert\(\));', false);