2007-05-03 04:07:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrTransform_BoolToCSSTest extends HTMLPurifier_AttrTransformHarness
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2007-05-03 04:07:47 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_AttrTransform_BoolToCSS('foo', 'bar:3in;');
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testEmptyInput()
|
|
|
|
{
|
2007-05-03 04:07:47 +00:00
|
|
|
$this->assertResult( array() );
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testBasicTransform()
|
|
|
|
{
|
2007-05-03 04:07:47 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('foo' => 'foo'),
|
|
|
|
array('style' => 'bar:3in;')
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testIgnoreValueOfBooleanAttribute()
|
|
|
|
{
|
2007-05-03 04:07:47 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('foo' => 'no'),
|
|
|
|
array('style' => 'bar:3in;')
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testPrependCSS()
|
|
|
|
{
|
2007-05-03 04:07:47 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('foo' => 'foo', 'style' => 'background-color:#F00;'),
|
|
|
|
array('style' => 'bar:3in;background-color:#F00;')
|
|
|
|
);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-03 04:07:47 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|