mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-10-23 09:36:19 +02:00
Release 2.0.0, merged in 1026 to HEAD.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/strict@1179 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -14,6 +14,7 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest
|
||||
|
||||
function test() {
|
||||
|
||||
$this->config = array('HTML.Doctype' => 'XHTML 1.0 Strict');
|
||||
|
||||
$this->assertResult('');
|
||||
|
||||
@@ -24,6 +25,17 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest
|
||||
'BlingBong'
|
||||
);
|
||||
|
||||
$this->assertResult(
|
||||
'<script>alert();</script>',
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertResult(
|
||||
'<script>alert();</script>',
|
||||
'alert();',
|
||||
array('Core.RemoveScriptContents' => false)
|
||||
);
|
||||
|
||||
$this->assertResult(
|
||||
'<menu><li>Item 1</li></menu>',
|
||||
'<ul><li>Item 1</li></ul>'
|
||||
@@ -49,7 +61,7 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest
|
||||
);
|
||||
|
||||
// test preservation of valid img tag
|
||||
$this->assertResult('<img src="foobar.gif" />');
|
||||
$this->assertResult('<img src="foobar.gif" alt="foobar.gif" />');
|
||||
|
||||
// test preservation of invalid img tag when removal is disabled
|
||||
$this->assertResult(
|
||||
@@ -60,6 +72,13 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest
|
||||
)
|
||||
);
|
||||
|
||||
// test transform to unallowed element
|
||||
$this->assertResult(
|
||||
'<font color="red" face="Arial" size="6">Big Warning!</font>',
|
||||
'Big Warning!',
|
||||
array('HTML.Allowed' => 'div')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user