obj = new HTMLPurifier_Strategy_RemoveForeignElements();
}
function testBlankInput() {
$this->assertResult('');
}
function testPreserveRecognizedElements() {
$this->assertResult('This is bold text.');
}
function testRemoveForeignElements() {
$this->assertResult(
'BlingBong',
'BlingBong'
);
}
function testRemoveScriptAndContents() {
$this->assertResult(
'',
''
);
}
function testRemoveStyleAndContents() {
$this->assertResult(
'',
''
);
}
function testRemoveOnlyScriptTagsLegacy() {
$this->config->set('Core', 'RemoveScriptContents', false);
$this->assertResult(
'',
'alert();'
);
}
function testRemoveOnlyScriptTags() {
$this->config->set('Core', 'HiddenElements', array());
$this->assertResult(
'',
'alert();'
);
}
function testRemoveInvalidImg() {
$this->assertResult('', '');
}
function testPreserveValidImg() {
$this->assertResult('');
}
function testPreserveInvalidImgWhenRemovalIsDisabled() {
$this->config->set('Core', 'RemoveInvalidImg', false);
$this->assertResult('');
}
function testTextifyCommentedScriptContents() {
$this->config->set('HTML', 'Trusted', true);
$this->config->set('Output', 'CommentScriptContents', false); // simplify output
$this->assertResult(
'',
''
);
}
function testRequiredAttributesTestNotPerformedOnEndTag() {
$this->config->set('HTML', 'DefinitionID',
'HTMLPurifier_Strategy_RemoveForeignElementsTest'.
'->testRequiredAttributesTestNotPerformedOnEndTag');
$def = $this->config->getHTMLDefinition(true);
$def->addElement('f', 'Block', 'Optional: #PCDATA', false, array('req*' => 'Text'));
$this->assertResult('Foo Bar');
}
function testPreserveCommentsWithHTMLTrusted() {
$this->config->set('HTML', 'Trusted', true);
$this->assertResult('');
}
function testRemoveTrailingHyphensInComment() {
$this->config->set('HTML', 'Trusted', true);
$this->assertResult('', '');
}
function testCollapseDoubleHyphensInComment() {
$this->config->set('HTML', 'Trusted', true);
$this->assertResult('', '');
}
}