3 class HTMLPurifier_AttrDef_HTML_PixelsTest
extends HTMLPurifier_AttrDefHarness
6 public function setup()
8 $this->def
= new HTMLPurifier_AttrDef_HTML_Pixels();
11 public function test()
13 $this->assertDef('1');
14 $this->assertDef('0');
16 $this->assertDef('2px', '2'); // rm px suffix
18 $this->assertDef('dfs', false); // totally invalid value
20 // conceivably we could repair this value, but we won't for now
21 $this->assertDef('9in', false);
24 $this->assertDef(' 45 ', '45');
27 $this->assertDef('-2', '0');
30 $this->assertDef('', false);
33 $this->assertDef('4.9', '4');
37 public function test_make()
39 $factory = new HTMLPurifier_AttrDef_HTML_Pixels();
40 $this->def
= $factory->make('30');
41 $this->assertDef('25');
42 $this->assertDef('35', '30');