3 class HTMLPurifier_Strategy_ValidateAttributes_TidyTest
extends HTMLPurifier_StrategyHarness
8 $this->obj
= new HTMLPurifier_Strategy_ValidateAttributes();
9 $this->config
->set('HTML', 'TidyLevel', 'heavy');
12 function testConvertCenterAlign() {
14 '<h1 align="center">Centered Headline</h1>',
15 '<h1 style="text-align:center;">Centered Headline</h1>'
19 function testConvertRightAlign() {
21 '<h1 align="right">Right-aligned Headline</h1>',
22 '<h1 style="text-align:right;">Right-aligned Headline</h1>'
26 function testConvertLeftAlign() {
28 '<h1 align="left">Left-aligned Headline</h1>',
29 '<h1 style="text-align:left;">Left-aligned Headline</h1>'
33 function testConvertJustifyAlign() {
35 '<p align="justify">Justified Paragraph</p>',
36 '<p style="text-align:justify;">Justified Paragraph</p>'
40 function testRemoveInvalidAlign() {
42 '<h1 align="invalid">Invalid Headline</h1>',
43 '<h1>Invalid Headline</h1>'
47 function testConvertTableLengths() {
49 '<td width="5%" height="10" /><th width="10" height="5%" /><hr width="10" height="10" />',
50 '<td style="width:5%;height:10px;" /><th style="width:10px;height:5%;" /><hr style="width:10px;" />'
54 function testTdConvertNowrap() {
57 '<td style="white-space:nowrap;" />'
61 function testCaptionConvertAlignLeft() {
63 '<caption align="left" />',
64 '<caption style="text-align:left;" />'
68 function testCaptionConvertAlignRight() {
70 '<caption align="right" />',
71 '<caption style="text-align:right;" />'
75 function testCaptionConvertAlignTop() {
77 '<caption align="top" />',
78 '<caption style="caption-side:top;" />'
82 function testCaptionConvertAlignBottom() {
84 '<caption align="bottom" />',
85 '<caption style="caption-side:bottom;" />'
89 function testCaptionRemoveInvalidAlign() {
91 '<caption align="nonsense" />',
96 function testTableConvertAlignLeft() {
98 '<table align="left" />',
99 '<table style="float:left;" />'
103 function testTableConvertAlignCenter() {
105 '<table align="center" />',
106 '<table style="margin-left:auto;margin-right:auto;" />'
110 function testTableConvertAlignRight() {
112 '<table align="right" />',
113 '<table style="float:right;" />'
117 function testTableRemoveInvalidAlign() {
119 '<table align="top" />',
124 function testImgConvertAlignLeft() {
126 '<img src="foobar.jpg" alt="foobar" align="left" />',
127 '<img src="foobar.jpg" alt="foobar" style="float:left;" />'
131 function testImgConvertAlignRight() {
133 '<img src="foobar.jpg" alt="foobar" align="right" />',
134 '<img src="foobar.jpg" alt="foobar" style="float:right;" />'
138 function testImgConvertAlignBottom() {
140 '<img src="foobar.jpg" alt="foobar" align="bottom" />',
141 '<img src="foobar.jpg" alt="foobar" style="vertical-align:baseline;" />'
145 function testImgConvertAlignMiddle() {
147 '<img src="foobar.jpg" alt="foobar" align="middle" />',
148 '<img src="foobar.jpg" alt="foobar" style="vertical-align:middle;" />'
152 function testImgConvertAlignTop() {
154 '<img src="foobar.jpg" alt="foobar" align="top" />',
155 '<img src="foobar.jpg" alt="foobar" style="vertical-align:top;" />'
159 function testImgRemoveInvalidAlign() {
161 '<img src="foobar.jpg" alt="foobar" align="outerspace" />',
162 '<img src="foobar.jpg" alt="foobar" />'
166 function testBorderConvertHVSpace() {
168 '<img src="foo" alt="foo" hspace="1" vspace="3" />',
169 '<img src="foo" alt="foo" style="margin-top:3px;margin-bottom:3px;margin-left:1px;margin-right:1px;" />'
173 function testHrConvertSize() {
176 '<hr style="height:3px;" />'
180 function testHrConvertNoshade() {
183 '<hr style="color:#808080;background-color:#808080;border:0;" />'
187 function testHrConvertAlignLeft() {
189 '<hr align="left" />',
190 '<hr style="margin-left:0;margin-right:auto;text-align:left;" />'
194 function testHrConvertAlignCenter() {
196 '<hr align="center" />',
197 '<hr style="margin-left:auto;margin-right:auto;text-align:center;" />'
201 function testHrConvertAlignRight() {
203 '<hr align="right" />',
204 '<hr style="margin-left:auto;margin-right:0;text-align:right;" />'
208 function testHrRemoveInvalidAlign() {
210 '<hr align="bottom" />',
215 function testBrConvertClearLeft() {
217 '<br clear="left" />',
218 '<br style="clear:left;" />'
222 function testBrConvertClearRight() {
224 '<br clear="right" />',
225 '<br style="clear:right;" />'
229 function testBrConvertClearAll() {
231 '<br clear="all" />',
232 '<br style="clear:both;" />'
236 function testBrConvertClearNone() {
238 '<br clear="none" />',
239 '<br style="clear:none;" />'
243 function testBrRemoveInvalidClear() {
245 '<br clear="foo" />',
250 function testUlConvertTypeDisc() {
252 '<ul type="disc" />',
253 '<ul style="list-style-type:disc;" />'
257 function testUlConvertTypeSquare() {
259 '<ul type="square" />',
260 '<ul style="list-style-type:square;" />'
264 function testUlConvertTypeCircle() {
266 '<ul type="circle" />',
267 '<ul style="list-style-type:circle;" />'
271 function testUlConvertTypeCaseInsensitive() {
273 '<ul type="CIRCLE" />',
274 '<ul style="list-style-type:circle;" />'
278 function testUlRemoveInvalidType() {
285 function testOlConvertType1() {
288 '<ol style="list-style-type:decimal;" />'
292 function testOlConvertTypeLowerI() {
295 '<ol style="list-style-type:lower-roman;" />'
299 function testOlConvertTypeUpperI() {
302 '<ol style="list-style-type:upper-roman;" />'
306 function testOlConvertTypeLowerA() {
309 '<ol style="list-style-type:lower-alpha;" />'
313 function testOlConvertTypeUpperA() {
316 '<ol style="list-style-type:upper-alpha;" />'
320 function testOlRemoveInvalidType() {
322 '<ol type="disc" />',
327 function testLiConvertTypeCircle() {
329 '<li type="circle" />',
330 '<li style="list-style-type:circle;" />'
334 function testLiConvertTypeA() {
337 '<li style="list-style-type:upper-alpha;" />'
341 function testLiConvertTypeCaseSensitive() {
343 '<li type="CIRCLE" />',