mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 19:30:21 +02:00
Implement %Attr.AllowedClasses and %Attr.ForbiddenClasses.
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
21
tests/HTMLPurifier/AttrDef/HTML/ClassTest.php
Normal file
21
tests/HTMLPurifier/AttrDef/HTML/ClassTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class HTMLPurifier_AttrDef_HTML_ClassTest extends HTMLPurifier_AttrDef_HTML_NmtokensTest
|
||||
{
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->def = new HTMLPurifier_AttrDef_HTML_Class();
|
||||
}
|
||||
function testAllowedClasses() {
|
||||
$this->config->set('Attr.AllowedClasses', array('foo'));
|
||||
$this->assertDef('foo');
|
||||
$this->assertDef('bar', false);
|
||||
$this->assertDef('foo bar', 'foo');
|
||||
}
|
||||
function testForbiddenClasses() {
|
||||
$this->config->set('Attr.ForbiddenClasses', array('bar'));
|
||||
$this->assertDef('foo');
|
||||
$this->assertDef('bar', false);
|
||||
$this->assertDef('foo bar', 'foo');
|
||||
}
|
||||
}
|
@@ -3,9 +3,12 @@
|
||||
class HTMLPurifier_AttrDef_HTML_NmtokensTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
function testDefault() {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->def = new HTMLPurifier_AttrDef_HTML_Nmtokens();
|
||||
}
|
||||
|
||||
function testDefault() {
|
||||
|
||||
$this->assertDef('valid');
|
||||
$this->assertDef('a0-_');
|
||||
|
Reference in New Issue
Block a user