2007-05-13 20:43:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_HTMLModule_ImageTest extends HTMLPurifier_HTMLModuleHarness
|
|
|
|
{
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
|
2007-05-20 22:29:31 +00:00
|
|
|
$this->setupScaffold('Image');
|
|
|
|
|
2007-05-13 20:43:38 +00:00
|
|
|
// max
|
|
|
|
$this->assertResult(
|
|
|
|
'<span>
|
|
|
|
<img
|
|
|
|
src="example.png"
|
|
|
|
alt="Example image"
|
|
|
|
longdesc="example.description.txt"
|
|
|
|
height="42"
|
|
|
|
width="42"
|
2007-05-20 22:29:31 +00:00
|
|
|
ac:common="yes"
|
2007-05-13 20:43:38 +00:00
|
|
|
/>
|
|
|
|
</span>'
|
|
|
|
);
|
|
|
|
|
|
|
|
// required attributes
|
|
|
|
$this->assertResult(
|
|
|
|
'<img src="foo.png" />',
|
|
|
|
'<img src="foo.png" alt="foo.png" />'
|
|
|
|
);
|
|
|
|
|
|
|
|
// empty
|
|
|
|
$this->assertResult(
|
|
|
|
'<img src="foo.png" alt="foo">',
|
|
|
|
'<img src="foo.png" alt="foo" />'
|
|
|
|
);
|
|
|
|
|
|
|
|
// unsupported attributes
|
|
|
|
$this->assertResult(
|
|
|
|
'<img
|
|
|
|
src="example.png"
|
|
|
|
alt="Example"
|
|
|
|
usemap="#foo"
|
|
|
|
ismap="ismap"
|
|
|
|
/>',
|
|
|
|
'<img src="example.png" alt="Example" />'
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|