Fix autoparagraph bug with non-inline elements.
[htmlpurifier.git] / tests / HTMLPurifier / Strategy / ValidateAttributes_IDTest.php
blobc8c75072342281d0b969b8601536559f5071d044
1 <?php
3 class HTMLPurifier_Strategy_ValidateAttributes_IDTest extends HTMLPurifier_StrategyHarness
6 function setUp() {
7 parent::setUp();
8 $this->obj = new HTMLPurifier_Strategy_ValidateAttributes();
9 $this->config->set('Attr.EnableID', true);
13 function testPreserveIDWhenEnabled() {
14 $this->assertResult('<div id="valid">Preserve the ID.</div>');
17 function testRemoveInvalidID() {
18 $this->assertResult(
19 '<div id="0invalid">Kill the ID.</div>',
20 '<div>Kill the ID.</div>'
24 function testRemoveDuplicateID() {
25 $this->assertResult(
26 '<div id="valid">Valid</div><div id="valid">Invalid</div>',
27 '<div id="valid">Valid</div><div>Invalid</div>'
31 function testAttributeKeyCaseInsensitivity() {
32 $this->assertResult(
33 '<div ID="valid">Convert ID to lowercase.</div>',
34 '<div id="valid">Convert ID to lowercase.</div>'
38 function testTrimWhitespace() {
39 $this->assertResult(
40 '<div id=" valid ">Trim whitespace.</div>',
41 '<div id="valid">Trim whitespace.</div>'
45 function testIDBlacklist() {
46 $this->config->set('Attr.IDBlacklist', array('invalid'));
47 $this->assertResult(
48 '<div id="invalid">Invalid</div>',
49 '<div>Invalid</div>'
53 function testNameConvertedToID() {
54 $this->config->set('HTML.TidyLevel', 'heavy');
55 $this->assertResult(
56 '<a name="foobar" />',
57 '<a id="foobar" />'
63 // vim: et sw=4 sts=4