1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-01 11:50:28 +02:00

[3.1.0] Add missing tests and errors for forbidden attributes

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1706 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-05-13 01:41:25 +00:00
parent 9f37764614
commit ce46fb618c
4 changed files with 32 additions and 3 deletions

View File

@@ -214,6 +214,28 @@ a[href|title]
$this->assertPurification('<b style="float:left;">Test</b>');
}
function test_ForbiddenAttributes_incorrectGlobalSyntax() {
$this->config->set('HTML', 'ForbiddenAttributes', '*.style');
$this->expectError("Error with *.style: *.attr syntax not supported for HTML.ForbiddenAttributes; use attr instead");
$this->assertPurification('<b style="float:left;">Test</b>');
}
function assertPurification_ForbiddenAttributes_style() {
$this->assertPurification(
'<b class="foo" style="float:left;">b</b><i style="float:left;">i</i>',
'<b class="foo">b</b><i>i</i>');
}
function test_ForbiddenAttributes_global() {
$this->config->set('HTML', 'ForbiddenAttributes', 'style');
$this->assertPurification_ForbiddenAttributes_style();
}
function test_ForbiddenAttributes_globalVerboseFormat() {
$this->config->set('HTML', 'ForbiddenAttributes', '*@style');
$this->assertPurification_ForbiddenAttributes_style();
}
function test_addAttribute() {
$config = HTMLPurifier_Config::create(array(