PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / tests / HTMLPurifier / Strategy / ValidateAttributes_TidyTest.php
blob3830a401e0ec99f840677e52dc03c9e077c793de
1 <?php
3 class HTMLPurifier_Strategy_ValidateAttributes_TidyTest extends HTMLPurifier_StrategyHarness
6 public function setUp()
8 parent::setUp();
9 $this->obj = new HTMLPurifier_Strategy_ValidateAttributes();
10 $this->config->set('HTML.TidyLevel', 'heavy');
13 public function testConvertCenterAlign()
15 $this->assertResult(
16 '<h1 align="center">Centered Headline</h1>',
17 '<h1 style="text-align:center;">Centered Headline</h1>'
21 public function testConvertRightAlign()
23 $this->assertResult(
24 '<h1 align="right">Right-aligned Headline</h1>',
25 '<h1 style="text-align:right;">Right-aligned Headline</h1>'
29 public function testConvertLeftAlign()
31 $this->assertResult(
32 '<h1 align="left">Left-aligned Headline</h1>',
33 '<h1 style="text-align:left;">Left-aligned Headline</h1>'
37 public function testConvertJustifyAlign()
39 $this->assertResult(
40 '<p align="justify">Justified Paragraph</p>',
41 '<p style="text-align:justify;">Justified Paragraph</p>'
45 public function testRemoveInvalidAlign()
47 $this->assertResult(
48 '<h1 align="invalid">Invalid Headline</h1>',
49 '<h1>Invalid Headline</h1>'
53 public function testConvertTableLengths()
55 $this->assertResult(
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()
63 $this->assertResult(
64 '<td nowrap />',
65 '<td style="white-space:nowrap;" />'
69 public function testCaptionConvertAlignLeft()
71 $this->assertResult(
72 '<caption align="left" />',
73 '<caption style="text-align:left;" />'
77 public function testCaptionConvertAlignRight()
79 $this->assertResult(
80 '<caption align="right" />',
81 '<caption style="text-align:right;" />'
85 public function testCaptionConvertAlignTop()
87 $this->assertResult(
88 '<caption align="top" />',
89 '<caption style="caption-side:top;" />'
93 public function testCaptionConvertAlignBottom()
95 $this->assertResult(
96 '<caption align="bottom" />',
97 '<caption style="caption-side:bottom;" />'
101 public function testCaptionRemoveInvalidAlign()
103 $this->assertResult(
104 '<caption align="nonsense" />',
105 '<caption />'
109 public function testTableConvertAlignLeft()
111 $this->assertResult(
112 '<table align="left" />',
113 '<table style="float:left;" />'
117 public function testTableConvertAlignCenter()
119 $this->assertResult(
120 '<table align="center" />',
121 '<table style="margin-left:auto;margin-right:auto;" />'
125 public function testTableConvertAlignRight()
127 $this->assertResult(
128 '<table align="right" />',
129 '<table style="float:right;" />'
133 public function testTableRemoveInvalidAlign()
135 $this->assertResult(
136 '<table align="top" />',
137 '<table />'
141 public function testImgConvertAlignLeft()
143 $this->assertResult(
144 '<img src="foobar.jpg" alt="foobar" align="left" />',
145 '<img src="foobar.jpg" alt="foobar" style="float:left;" />'
149 public function testImgConvertAlignRight()
151 $this->assertResult(
152 '<img src="foobar.jpg" alt="foobar" align="right" />',
153 '<img src="foobar.jpg" alt="foobar" style="float:right;" />'
157 public function testImgConvertAlignBottom()
159 $this->assertResult(
160 '<img src="foobar.jpg" alt="foobar" align="bottom" />',
161 '<img src="foobar.jpg" alt="foobar" style="vertical-align:baseline;" />'
165 public function testImgConvertAlignMiddle()
167 $this->assertResult(
168 '<img src="foobar.jpg" alt="foobar" align="middle" />',
169 '<img src="foobar.jpg" alt="foobar" style="vertical-align:middle;" />'
173 public function testImgConvertAlignTop()
175 $this->assertResult(
176 '<img src="foobar.jpg" alt="foobar" align="top" />',
177 '<img src="foobar.jpg" alt="foobar" style="vertical-align:top;" />'
181 public function testImgRemoveInvalidAlign()
183 $this->assertResult(
184 '<img src="foobar.jpg" alt="foobar" align="outerspace" />',
185 '<img src="foobar.jpg" alt="foobar" />'
189 public function testBorderConvertHVSpace()
191 $this->assertResult(
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()
199 $this->assertResult(
200 '<hr size="3" />',
201 '<hr style="height:3px;" />'
205 public function testHrConvertNoshade()
207 $this->assertResult(
208 '<hr noshade />',
209 '<hr style="color:#808080;background-color:#808080;border:0;" />'
213 public function testHrConvertAlignLeft()
215 $this->assertResult(
216 '<hr align="left" />',
217 '<hr style="margin-left:0;margin-right:auto;text-align:left;" />'
221 public function testHrConvertAlignCenter()
223 $this->assertResult(
224 '<hr align="center" />',
225 '<hr style="margin-left:auto;margin-right:auto;text-align:center;" />'
229 public function testHrConvertAlignRight()
231 $this->assertResult(
232 '<hr align="right" />',
233 '<hr style="margin-left:auto;margin-right:0;text-align:right;" />'
237 public function testHrRemoveInvalidAlign()
239 $this->assertResult(
240 '<hr align="bottom" />',
241 '<hr />'
245 public function testBrConvertClearLeft()
247 $this->assertResult(
248 '<br clear="left" />',
249 '<br style="clear:left;" />'
253 public function testBrConvertClearRight()
255 $this->assertResult(
256 '<br clear="right" />',
257 '<br style="clear:right;" />'
261 public function testBrConvertClearAll()
263 $this->assertResult(
264 '<br clear="all" />',
265 '<br style="clear:both;" />'
269 public function testBrConvertClearNone()
271 $this->assertResult(
272 '<br clear="none" />',
273 '<br style="clear:none;" />'
277 public function testBrRemoveInvalidClear()
279 $this->assertResult(
280 '<br clear="foo" />',
281 '<br />'
285 public function testUlConvertTypeDisc()
287 $this->assertResult(
288 '<ul type="disc" />',
289 '<ul style="list-style-type:disc;" />'
293 public function testUlConvertTypeSquare()
295 $this->assertResult(
296 '<ul type="square" />',
297 '<ul style="list-style-type:square;" />'
301 public function testUlConvertTypeCircle()
303 $this->assertResult(
304 '<ul type="circle" />',
305 '<ul style="list-style-type:circle;" />'
309 public function testUlConvertTypeCaseInsensitive()
311 $this->assertResult(
312 '<ul type="CIRCLE" />',
313 '<ul style="list-style-type:circle;" />'
317 public function testUlRemoveInvalidType()
319 $this->assertResult(
320 '<ul type="a" />',
321 '<ul />'
325 public function testOlConvertType1()
327 $this->assertResult(
328 '<ol type="1" />',
329 '<ol style="list-style-type:decimal;" />'
333 public function testOlConvertTypeLowerI()
335 $this->assertResult(
336 '<ol type="i" />',
337 '<ol style="list-style-type:lower-roman;" />'
341 public function testOlConvertTypeUpperI()
343 $this->assertResult(
344 '<ol type="I" />',
345 '<ol style="list-style-type:upper-roman;" />'
349 public function testOlConvertTypeLowerA()
351 $this->assertResult(
352 '<ol type="a" />',
353 '<ol style="list-style-type:lower-alpha;" />'
357 public function testOlConvertTypeUpperA()
359 $this->assertResult(
360 '<ol type="A" />',
361 '<ol style="list-style-type:upper-alpha;" />'
365 public function testOlRemoveInvalidType()
367 $this->assertResult(
368 '<ol type="disc" />',
369 '<ol />'
373 public function testLiConvertTypeCircle()
375 $this->assertResult(
376 '<li type="circle" />',
377 '<li style="list-style-type:circle;" />'
381 public function testLiConvertTypeA()
383 $this->assertResult(
384 '<li type="A" />',
385 '<li style="list-style-type:upper-alpha;" />'
389 public function testLiConvertTypeCaseSensitive()
391 $this->assertResult(
392 '<li type="CIRCLE" />',
393 '<li />'
400 // vim: et sw=4 sts=4