Fix CSS URL innerHTML/cssText escaping bug.
[htmlpurifier.git] / tests / HTMLPurifier / AttrDef / HTML / ClassTest.php
blob6effd3cdeee6220d1ef58976d63e8f149a23c01c
1 <?php
3 class HTMLPurifier_AttrDef_HTML_ClassTest extends HTMLPurifier_AttrDef_HTML_NmtokensTest
5 function setUp() {
6 parent::setUp();
7 $this->def = new HTMLPurifier_AttrDef_HTML_Class();
9 function testAllowedClasses() {
10 $this->config->set('Attr.AllowedClasses', array('foo'));
11 $this->assertDef('foo');
12 $this->assertDef('bar', false);
13 $this->assertDef('foo bar', 'foo');
15 function testForbiddenClasses() {
16 $this->config->set('Attr.ForbiddenClasses', array('bar'));
17 $this->assertDef('foo');
18 $this->assertDef('bar', false);
19 $this->assertDef('foo bar', 'foo');
21 function testDefault() {
22 $this->assertDef('valid');
23 $this->assertDef('a0-_');
24 $this->assertDef('-valid');
25 $this->assertDef('_valid');
26 $this->assertDef('double valid');
28 $this->assertDef('0stillvalid');
29 $this->assertDef('-0');
31 // test conditional replacement
32 $this->assertDef('validassoc 0valid', 'validassoc 0valid');
34 // test whitespace leniency
35 $this->assertDef(" double\nvalid\r", 'double valid');
37 // test case sensitivity
38 $this->assertDef('VALID');
40 // test duplicate removal
41 $this->assertDef('valid valid', 'valid');
43 function testXHTML11Behavior() {
44 $this->config->set('HTML.Doctype', 'XHTML 1.1');
45 $this->assertDef('0invalid', false);
46 $this->assertDef('valid valid', 'valid');