2008-06-25 01:10:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_Strategy_RemoveForeignElements_TidyTest
|
|
|
|
extends HTMLPurifier_StrategyHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2008-06-25 01:10:51 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_Strategy_RemoveForeignElements();
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('HTML.TidyLevel', 'heavy');
|
2008-06-25 01:10:51 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testCenterTransform()
|
|
|
|
{
|
2008-06-25 01:10:51 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<center>Look I am Centered!</center>',
|
|
|
|
'<div style="text-align:center;">Look I am Centered!</div>'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testFontTransform()
|
|
|
|
{
|
2008-06-25 01:10:51 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<font color="red" face="Arial" size="6">Big Warning!</font>',
|
|
|
|
'<span style="color:red;font-family:Arial;font-size:xx-large;">Big'.
|
|
|
|
' Warning!</span>'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testTransformToForbiddenElement()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('HTML.Allowed', 'div');
|
2008-06-25 01:10:51 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<font color="red" face="Arial" size="6">Big Warning!</font>',
|
|
|
|
'Big Warning!'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testMenuTransform()
|
|
|
|
{
|
2008-06-25 01:10:51 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<menu><li>Item 1</li></menu>',
|
|
|
|
'<ul><li>Item 1</li></ul>'
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-06-25 01:10:51 +00:00
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|