Always quote the contents of url() in CSS.
[htmlpurifier.git] / tests / HTMLPurifier / AttrDef / CSS / URITest.php
blob20cc79d26cfd40080c2b810cee57829bbcb9680d
1 <?php
3 class HTMLPurifier_AttrDef_CSS_URITest extends HTMLPurifier_AttrDefHarness
6 function test() {
8 $this->def = new HTMLPurifier_AttrDef_CSS_URI();
10 $this->assertDef('', false);
12 // we could be nice but we won't be
13 $this->assertDef('http://www.example.com/', false);
15 // no quotes are used, since that's the most widely supported
16 // syntax
17 $this->assertDef('url(', false);
18 $this->assertDef('url(\'\')', true);
19 $result = "url('http://www.example.com/')";
20 $this->assertDef('url(http://www.example.com/)', $result);
21 $this->assertDef('url("http://www.example.com/")', $result);
22 $this->assertDef("url('http://www.example.com/')", $result);
23 $this->assertDef(
24 ' url( "http://www.example.com/" ) ', $result);
26 // escaping
27 $this->assertDef("url(http://www.example.com/foo,bar\))",
28 "url('http://www.example.com/foo\,bar\)')");
33 // vim: et sw=4 sts=4