diff --git a/library/HTMLPurifier/HTMLModule/Image.php b/library/HTMLPurifier/HTMLModule/Image.php index 6608e9dc..dc9c732b 100644 --- a/library/HTMLPurifier/HTMLModule/Image.php +++ b/library/HTMLPurifier/HTMLModule/Image.php @@ -14,8 +14,6 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule { var $name = 'Image'; - var $elements = array('img'); - var $content_sets = array('Inline' => 'img'); function HTMLPurifier_HTMLModule_Image() { $img =& $this->addElement( diff --git a/tests/HTMLPurifier/HTMLModule/BdoTest.php b/tests/HTMLPurifier/HTMLModule/BdoTest.php index c402fc29..b2fcc1c8 100644 --- a/tests/HTMLPurifier/HTMLModule/BdoTest.php +++ b/tests/HTMLPurifier/HTMLModule/BdoTest.php @@ -7,6 +7,7 @@ class HTMLPurifier_HTMLModule_BdoTest extends HTMLPurifier_HTMLModuleHarness function test() { + // max $this->assertResult( ' ', true, array('Attr.EnableID' => true) ); + // min + $this->assertResult( + '', '' + ); + + // children + $this->assertResult( + 'Text
', + 'Text' + ); + + // global attr + $this->assertResult( + '
', + '
' + ); + } } diff --git a/tests/HTMLPurifier/HTMLModule/EditTest.php b/tests/HTMLPurifier/HTMLModule/EditTest.php new file mode 100644 index 00000000..3acf7917 --- /dev/null +++ b/tests/HTMLPurifier/HTMLModule/EditTest.php @@ -0,0 +1,58 @@ +assertResult( + ' + + #PCDATA + + + #PCDATA + + +
+ + #PCDATA
+
+ + #PCDATA
+
+
' + ); + + // inline removal + $this->assertResult( + ' +
+
+
', + ' + + + ' + ); + + // unsupported attributes + $this->assertResult( + ' + ', + ' + ' + ); + + } + +} + +?> \ No newline at end of file diff --git a/tests/HTMLPurifier/HTMLModule/HypertextTest.php b/tests/HTMLPurifier/HTMLModule/HypertextTest.php new file mode 100644 index 00000000..41d364dc --- /dev/null +++ b/tests/HTMLPurifier/HTMLModule/HypertextTest.php @@ -0,0 +1,52 @@ +assertResult( + ' + + #PCDATA Inline + + ', true, array( + 'Attr.AllowedRel' => 'nofollow', + 'Attr.AllowedRev' => 'index' + ) + ); + + // invalid children + $this->assertResult( + 'Text
', + 'Text' + ); + + // unsupported attributes + $this->assertResult( + '', + '' + ); + + } + +} + +?> \ No newline at end of file diff --git a/tests/HTMLPurifier/HTMLModule/ImageTest.php b/tests/HTMLPurifier/HTMLModule/ImageTest.php new file mode 100644 index 00000000..3156af8a --- /dev/null +++ b/tests/HTMLPurifier/HTMLModule/ImageTest.php @@ -0,0 +1,50 @@ +assertResult( + ' + Example image + ' + ); + + // required attributes + $this->assertResult( + '', + 'foo.png' + ); + + // empty + $this->assertResult( + 'foo', + 'foo' + ); + + // unsupported attributes + $this->assertResult( + 'Example', + 'Example' + ); + + } + +} + +?> \ No newline at end of file diff --git a/tests/HTMLPurifier/HTMLModule/LegacyTest.php b/tests/HTMLPurifier/HTMLModule/LegacyTest.php new file mode 100644 index 00000000..8d345552 --- /dev/null +++ b/tests/HTMLPurifier/HTMLModule/LegacyTest.php @@ -0,0 +1,32 @@ +assertResult( + ' + Text + Text + Text + ' + ); + + // redefinitions + /*$this->assertResult( + '
    +
  1. Foo
  2. +
+
Text

+
Text
' + );*/ + + } + +} + +?> \ No newline at end of file diff --git a/tests/test_files.php b/tests/test_files.php index 0f989c75..d0ec5089 100644 --- a/tests/test_files.php +++ b/tests/test_files.php @@ -63,6 +63,10 @@ $test_files[] = 'GeneratorTest.php'; $test_files[] = 'HTMLModuleManagerTest.php'; $test_files[] = 'HTMLModuleTest.php'; $test_files[] = 'HTMLModule/BdoTest.php'; +$test_files[] = 'HTMLModule/EditTest.php'; +$test_files[] = 'HTMLModule/HypertextTest.php'; +$test_files[] = 'HTMLModule/ImageTest.php'; +$test_files[] = 'HTMLModule/LegacyTest.php'; $test_files[] = 'IDAccumulatorTest.php'; $test_files[] = 'LanguageFactoryTest.php'; $test_files[] = 'LanguageTest.php';