3 class HTMLPurifier_Strategy_ValidateAttributes_IDTest
extends HTMLPurifier_StrategyHarness
6 public function setUp()
9 $this->obj
= new HTMLPurifier_Strategy_ValidateAttributes();
10 $this->config
->set('Attr.EnableID', true);
14 public function testPreserveIDWhenEnabled()
16 $this->assertResult('<div id="valid">Preserve the ID.</div>');
19 public function testRemoveInvalidID()
22 '<div id="0invalid">Kill the ID.</div>',
23 '<div>Kill the ID.</div>'
27 public function testRemoveDuplicateID()
30 '<div id="valid">Valid</div><div id="valid">Invalid</div>',
31 '<div id="valid">Valid</div><div>Invalid</div>'
35 public function testAttributeKeyCaseInsensitivity()
38 '<div ID="valid">Convert ID to lowercase.</div>',
39 '<div id="valid">Convert ID to lowercase.</div>'
43 public function testTrimWhitespace()
46 '<div id=" valid ">Trim whitespace.</div>',
47 '<div id="valid">Trim whitespace.</div>'
51 public function testIDBlacklist()
53 $this->config
->set('Attr.IDBlacklist', array('invalid'));
55 '<div id="invalid">Invalid</div>',
60 public function testNameConvertedToID()
62 $this->config
->set('HTML.TidyLevel', 'heavy');
64 '<a name="foobar" />',