2007-01-14 15:54:05 +00:00
|
|
|
<?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
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
function test() {
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_URI();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
$this->assertDef('', false);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
// we could be nice but we won't be
|
|
|
|
$this->assertDef('http://www.example.com/', false);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
// 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);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
// escaping
|
2008-12-06 07:28:20 +00:00
|
|
|
$this->assertDef("url(http://www.example.com/foo,bar\))",
|
2007-01-14 15:54:05 +00:00
|
|
|
"url(http://www.example.com/foo\,bar\))");
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-14 15:54:05 +00:00
|
|
|
}
|
|
|
|
|