2007-01-14 15:54:05 +00:00
|
|
|
<?php
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDef/CSS/URI.php';
|
2007-01-14 15:54:05 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDefHarness.php';
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
class HTMLPurifier_AttrDef_CSS_URITest extends HTMLPurifier_AttrDefHarness
|
2007-01-14 15:54:05 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_URI();
|
2007-01-14 15:54:05 +00:00
|
|
|
|
|
|
|
$this->assertDef('', false);
|
|
|
|
|
|
|
|
// we could be nice but we won't be
|
|
|
|
$this->assertDef('http://www.example.com/', false);
|
|
|
|
|
|
|
|
// no quotes are used, since that's the most widely supported
|
|
|
|
// syntax
|
|
|
|
$this->assertDef('url(', false);
|
|
|
|
$this->assertDef('url()', true);
|
|
|
|
$result = "url(http://www.example.com/)";
|
|
|
|
$this->assertDef('url(http://www.example.com/)', $result);
|
|
|
|
$this->assertDef('url("http://www.example.com/")', $result);
|
|
|
|
$this->assertDef("url('http://www.example.com/')", $result);
|
|
|
|
$this->assertDef(
|
|
|
|
' url( "http://www.example.com/" ) ', $result);
|
|
|
|
|
|
|
|
// escaping
|
|
|
|
$this->assertDef("url(http://www.example.com/foo,bar\))",
|
|
|
|
"url(http://www.example.com/foo\,bar\))");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|