diff options
author | friendica <info@friendica.com> | 2012-05-12 17:57:41 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-18 20:40:31 +1000 |
commit | 7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a (patch) | |
tree | a9c3d91209cff770bb4b613b1b95e61a7bbc5a2b /lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php | |
parent | cd727cb26b78a1dade09d510b071446898477356 (diff) | |
download | volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.gz volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.bz2 volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.zip |
some important stuff we'll need
Diffstat (limited to 'lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php')
-rw-r--r-- | lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php new file mode 100644 index 000000000..c8c750723 --- /dev/null +++ b/lib/htmlpurifier/tests/HTMLPurifier/Strategy/ValidateAttributes_IDTest.php @@ -0,0 +1,63 @@ +<?php + +class HTMLPurifier_Strategy_ValidateAttributes_IDTest extends HTMLPurifier_StrategyHarness +{ + + function setUp() { + parent::setUp(); + $this->obj = new HTMLPurifier_Strategy_ValidateAttributes(); + $this->config->set('Attr.EnableID', true); + } + + + function testPreserveIDWhenEnabled() { + $this->assertResult('<div id="valid">Preserve the ID.</div>'); + } + + function testRemoveInvalidID() { + $this->assertResult( + '<div id="0invalid">Kill the ID.</div>', + '<div>Kill the ID.</div>' + ); + } + + function testRemoveDuplicateID() { + $this->assertResult( + '<div id="valid">Valid</div><div id="valid">Invalid</div>', + '<div id="valid">Valid</div><div>Invalid</div>' + ); + } + + function testAttributeKeyCaseInsensitivity() { + $this->assertResult( + '<div ID="valid">Convert ID to lowercase.</div>', + '<div id="valid">Convert ID to lowercase.</div>' + ); + } + + function testTrimWhitespace() { + $this->assertResult( + '<div id=" valid ">Trim whitespace.</div>', + '<div id="valid">Trim whitespace.</div>' + ); + } + + function testIDBlacklist() { + $this->config->set('Attr.IDBlacklist', array('invalid')); + $this->assertResult( + '<div id="invalid">Invalid</div>', + '<div>Invalid</div>' + ); + } + + function testNameConvertedToID() { + $this->config->set('HTML.TidyLevel', 'heavy'); + $this->assertResult( + '<a name="foobar" />', + '<a id="foobar" />' + ); + } + +} + +// vim: et sw=4 sts=4 |