mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-07 22:56:32 +02:00
Implement AttrDef_Class.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@157 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
32
tests/HTMLPurifier/AttrDef/ClassTest.php
Normal file
32
tests/HTMLPurifier/AttrDef/ClassTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Class.php';
|
||||
require_once 'HTMLPurifier/Config.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_ClassTest extends UnitTestCase
|
||||
{
|
||||
|
||||
function testDefault() {
|
||||
|
||||
$def = new HTMLPurifier_AttrDef_Class();
|
||||
|
||||
$this->assertTrue($def->validate('valid'));
|
||||
$this->assertTrue($def->validate('a0-_'));
|
||||
$this->assertTrue($def->validate('-valid'));
|
||||
$this->assertTrue($def->validate('_valid'));
|
||||
$this->assertTrue($def->validate('double valid'));
|
||||
|
||||
$this->assertFalse($def->validate('0invalid'));
|
||||
$this->assertFalse($def->validate('-0'));
|
||||
|
||||
// test conditional replacement
|
||||
$this->assertEqual('validassoc', $def->validate('validassoc 0invalid'));
|
||||
|
||||
// test whitespace leniency
|
||||
$this->assertTrue('double valid', $def->validate(" double\nvalid\r"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user