mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 23:58:41 +00:00
1675fc7caf
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
class HTMLPurifier_HTMLModule_TargetNoreferrerTest extends HTMLPurifier_HTMLModuleHarness
|
|
{
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
$this->config->set('HTML.TargetNoreferrer', true);
|
|
$this->config->set('Attr.AllowedFrameTargets', '_blank');
|
|
}
|
|
|
|
public function testNoreferrer()
|
|
{
|
|
$this->assertResult(
|
|
'<a href="http://google.com" target="_blank">x</a>',
|
|
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
|
);
|
|
}
|
|
|
|
public function testNoreferrerNoDupe()
|
|
{
|
|
$this->config->set('Attr.AllowedRel', 'noreferrer');
|
|
$this->assertResult(
|
|
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>',
|
|
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
|
);
|
|
}
|
|
|
|
public function testTargetBlankNoreferrer()
|
|
{
|
|
$this->config->set('HTML.TargetBlank', true);
|
|
$this->assertResult(
|
|
'<a href="http://google.com">x</a>',
|
|
'<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// vim: et sw=4 sts=4
|