3 class HTMLPurifier_Strategy_ValidateAttributes_TidyTest
extends HTMLPurifier_StrategyHarness
6 public function setUp()
9 $this->obj
= new HTMLPurifier_Strategy_ValidateAttributes();
10 $this->config
->set('HTML.TidyLevel', 'heavy');
13 public function testConvertCenterAlign()
16 '<h1 align="center">Centered Headline</h1>',
17 '<h1 style="text-align:center;">Centered Headline</h1>'
21 public function testConvertRightAlign()
24 '<h1 align="right">Right-aligned Headline</h1>',
25 '<h1 style="text-align:right;">Right-aligned Headline</h1>'
29 public function testConvertLeftAlign()
32 '<h1 align="left">Left-aligned Headline</h1>',
33 '<h1 style="text-align:left;">Left-aligned Headline</h1>'
37 public function testConvertJustifyAlign()
40 '<p align="justify">Justified Paragraph</p>',
41 '<p style="text-align:justify;">Justified Paragraph</p>'
45 public function testRemoveInvalidAlign()
48 '<h1 align="invalid">Invalid Headline</h1>',
49 '<h1>Invalid Headline</h1>'
53 public function testConvertTableLengths()
56 '<td width="5%" height="10" /><th width="10" height="5%" /><hr width="10" height="10" />',
57 '<td style="width:5%;height:10px;" /><th style="width:10px;height:5%;" /><hr style="width:10px;" />'
61 public function testTdConvertNowrap()
65 '<td style="white-space:nowrap;" />'
69 public function testCaptionConvertAlignLeft()
72 '<caption align="left" />',
73 '<caption style="text-align:left;" />'
77 public function testCaptionConvertAlignRight()
80 '<caption align="right" />',
81 '<caption style="text-align:right;" />'
85 public function testCaptionConvertAlignTop()
88 '<caption align="top" />',
89 '<caption style="caption-side:top;" />'
93 public function testCaptionConvertAlignBottom()
96 '<caption align="bottom" />',
97 '<caption style="caption-side:bottom;" />'
101 public function testCaptionRemoveInvalidAlign()
104 '<caption align="nonsense" />',
109 public function testTableConvertAlignLeft()
112 '<table align="left" />',
113 '<table style="float:left;" />'
117 public function testTableConvertAlignCenter()
120 '<table align="center" />',
121 '<table style="margin-left:auto;margin-right:auto;" />'
125 public function testTableConvertAlignRight()
128 '<table align="right" />',
129 '<table style="float:right;" />'
133 public function testTableRemoveInvalidAlign()
136 '<table align="top" />',
141 public function testImgConvertAlignLeft()
144 '<img src="foobar.jpg" alt="foobar" align="left" />',
145 '<img src="foobar.jpg" alt="foobar" style="float:left;" />'
149 public function testImgConvertAlignRight()
152 '<img src="foobar.jpg" alt="foobar" align="right" />',
153 '<img src="foobar.jpg" alt="foobar" style="float:right;" />'
157 public function testImgConvertAlignBottom()
160 '<img src="foobar.jpg" alt="foobar" align="bottom" />',
161 '<img src="foobar.jpg" alt="foobar" style="vertical-align:baseline;" />'
165 public function testImgConvertAlignMiddle()
168 '<img src="foobar.jpg" alt="foobar" align="middle" />',
169 '<img src="foobar.jpg" alt="foobar" style="vertical-align:middle;" />'
173 public function testImgConvertAlignTop()
176 '<img src="foobar.jpg" alt="foobar" align="top" />',
177 '<img src="foobar.jpg" alt="foobar" style="vertical-align:top;" />'
181 public function testImgRemoveInvalidAlign()
184 '<img src="foobar.jpg" alt="foobar" align="outerspace" />',
185 '<img src="foobar.jpg" alt="foobar" />'
189 public function testBorderConvertHVSpace()
192 '<img src="foo" alt="foo" hspace="1" vspace="3" />',
193 '<img src="foo" alt="foo" style="margin-top:3px;margin-bottom:3px;margin-left:1px;margin-right:1px;" />'
197 public function testHrConvertSize()
201 '<hr style="height:3px;" />'
205 public function testHrConvertNoshade()
209 '<hr style="color:#808080;background-color:#808080;border:0;" />'
213 public function testHrConvertAlignLeft()
216 '<hr align="left" />',
217 '<hr style="margin-left:0;margin-right:auto;text-align:left;" />'
221 public function testHrConvertAlignCenter()
224 '<hr align="center" />',
225 '<hr style="margin-left:auto;margin-right:auto;text-align:center;" />'
229 public function testHrConvertAlignRight()
232 '<hr align="right" />',
233 '<hr style="margin-left:auto;margin-right:0;text-align:right;" />'
237 public function testHrRemoveInvalidAlign()
240 '<hr align="bottom" />',
245 public function testBrConvertClearLeft()
248 '<br clear="left" />',
249 '<br style="clear:left;" />'
253 public function testBrConvertClearRight()
256 '<br clear="right" />',
257 '<br style="clear:right;" />'
261 public function testBrConvertClearAll()
264 '<br clear="all" />',
265 '<br style="clear:both;" />'
269 public function testBrConvertClearNone()
272 '<br clear="none" />',
273 '<br style="clear:none;" />'
277 public function testBrRemoveInvalidClear()
280 '<br clear="foo" />',
285 public function testUlConvertTypeDisc()
288 '<ul type="disc" />',
289 '<ul style="list-style-type:disc;" />'
293 public function testUlConvertTypeSquare()
296 '<ul type="square" />',
297 '<ul style="list-style-type:square;" />'
301 public function testUlConvertTypeCircle()
304 '<ul type="circle" />',
305 '<ul style="list-style-type:circle;" />'
309 public function testUlConvertTypeCaseInsensitive()
312 '<ul type="CIRCLE" />',
313 '<ul style="list-style-type:circle;" />'
317 public function testUlRemoveInvalidType()
325 public function testOlConvertType1()
329 '<ol style="list-style-type:decimal;" />'
333 public function testOlConvertTypeLowerI()
337 '<ol style="list-style-type:lower-roman;" />'
341 public function testOlConvertTypeUpperI()
345 '<ol style="list-style-type:upper-roman;" />'
349 public function testOlConvertTypeLowerA()
353 '<ol style="list-style-type:lower-alpha;" />'
357 public function testOlConvertTypeUpperA()
361 '<ol style="list-style-type:upper-alpha;" />'
365 public function testOlRemoveInvalidType()
368 '<ol type="disc" />',
373 public function testLiConvertTypeCircle()
376 '<li type="circle" />',
377 '<li style="list-style-type:circle;" />'
381 public function testLiConvertTypeA()
385 '<li style="list-style-type:upper-alpha;" />'
389 public function testLiConvertTypeCaseSensitive()
392 '<li type="CIRCLE" />',
400 // vim: et sw=4 sts=4