Whoops, forgot to edit WHATSNEW
[htmlpurifier.git] / tests / HTMLPurifier / AttrDef / CSS / FontFamilyTest.php
blob7f2fe0d0b88f93d1d469be343ef588e3f6b89496
1 <?php
3 class HTMLPurifier_AttrDef_CSS_FontFamilyTest extends HTMLPurifier_AttrDefHarness
6 public function test()
8 $this->def = new HTMLPurifier_AttrDef_CSS_FontFamily();
10 $this->assertDef('Gill, Helvetica, sans-serif');
11 $this->assertDef("'Times New Roman', serif");
12 $this->assertDef("\"Times New Roman\"", "'Times New Roman'");
13 $this->assertDef('01234');
14 $this->assertDef(',', false);
15 $this->assertDef('Times New Roman, serif', "'Times New Roman', serif");
16 $this->assertDef($d = "'\xE5\xAE\x8B\xE4\xBD\x93'");
17 $this->assertDef("\xE5\xAE\x8B\xE4\xBD\x93", $d);
18 $this->assertDef("'\\01'", "''");
19 $this->assertDef("'\\20'", "' '");
20 $this->assertDef("\\0020", "' '");
21 $this->assertDef("'\\000045'", "E");
22 $this->assertDef("','", false);
23 $this->assertDef("',' foobar','", "' foobar'");
24 $this->assertDef("'\\000045a'", "Ea");
25 $this->assertDef("'\\00045 a'", "Ea");
26 $this->assertDef("'\\00045 a'", "'E a'");
27 $this->assertDef("'\\\nf'", "f");
28 // No longer supported, except maybe in NoJS mode (see source
29 // file for more explanation)
30 //$this->assertDef($d = '"John\'s Font"');
31 //$this->assertDef("John's Font", $d);
32 //$this->assertDef("'\\','f'", "\"\\5C \", f");
33 //$this->assertDef("'\\27'", "\"'\"");
34 //$this->assertDef('"\\22"', "\"\\22 \"");
35 //$this->assertDef('"\\""', "\"\\22 \"");
36 //$this->assertDef('"\'"', "\"'\"");
39 public function testAllowed()
41 $this->config->set('CSS.AllowedFonts', array('serif', 'Times New Roman'));
43 $this->assertDef('serif');
44 $this->assertDef('sans-serif', false);
45 $this->assertDef('serif, sans-serif', 'serif');
46 $this->assertDef('Times New Roman', "'Times New Roman'");
47 $this->assertDef("'Times New Roman'");
48 $this->assertDef('foo', false);
53 // vim: et sw=4 sts=4