3 class HTMLPurifier_AttrDef_HTML_ClassTest
extends HTMLPurifier_AttrDef_HTML_NmtokensTest
5 public function setUp()
8 $this->def
= new HTMLPurifier_AttrDef_HTML_Class();
10 public function testAllowedClasses()
12 $this->config
->set('Attr.AllowedClasses', array('foo'));
13 $this->assertDef('foo');
14 $this->assertDef('bar', false);
15 $this->assertDef('foo bar', 'foo');
17 public function testForbiddenClasses()
19 $this->config
->set('Attr.ForbiddenClasses', array('bar'));
20 $this->assertDef('foo');
21 $this->assertDef('bar', false);
22 $this->assertDef('foo bar', 'foo');
24 public function testDefault()
26 $this->assertDef('valid');
27 $this->assertDef('a0-_');
28 $this->assertDef('-valid');
29 $this->assertDef('_valid');
30 $this->assertDef('double valid');
32 $this->assertDef('0stillvalid');
33 $this->assertDef('-0');
35 // test conditional replacement
36 $this->assertDef('validassoc 0valid', 'validassoc 0valid');
38 // test whitespace leniency
39 $this->assertDef(" double\nvalid\r", 'double valid');
41 // test case sensitivity
42 $this->assertDef('VALID');
44 // test duplicate removal
45 $this->assertDef('valid valid', 'valid');
47 public function testXHTML11Behavior()
49 $this->config
->set('HTML.Doctype', 'XHTML 1.1');
50 $this->assertDef('0invalid', false);
51 $this->assertDef('valid valid', 'valid');