Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / tests / HTMLPurifier / AttrTransform / ImgSpaceTest.php
blob8fc9178f7581cd697e017ee61fefb4c7a8cb1ac3
1 <?php
3 require_once 'HTMLPurifier/AttrTransform/ImgSpace.php';
4 require_once 'HTMLPurifier/AttrTransformHarness.php';
7 class HTMLPurifier_AttrTransform_ImgSpaceTest extends HTMLPurifier_AttrTransformHarness
10 function setUp() {
11 parent::setUp();
14 function testVertical() {
16 $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('vspace');
18 $this->assertResult( array() );
20 $this->assertResult(
21 array('vspace' => '1'),
22 array('style' => 'margin-top:1px;margin-bottom:1px;')
25 // no validation done here, we expect CSS validator to catch it
26 $this->assertResult(
27 array('vspace' => '10%'),
28 array('style' => 'margin-top:10%px;margin-bottom:10%px;')
31 $this->assertResult(
32 array('vspace' => '23', 'style' => 'font-weight:bold;'),
33 array('style' => 'margin-top:23px;margin-bottom:23px;font-weight:bold;')
38 function testHorizontal() {
39 $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('hspace');
40 $this->assertResult(
41 array('hspace' => '1'),
42 array('style' => 'margin-left:1px;margin-right:1px;')
46 function testInvalid() {
47 $this->expectError('ispace is not valid space attribute');
48 $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('ispace');
49 $this->assertResult(
50 array('ispace' => '1'),
51 array()