Add %HTML.TargetNoreferrer, which adds rel="noreferrer" when target attribute is set
[htmlpurifier.git] / tests / HTMLPurifier / HTMLModule / TargetNoreferrerTest.php
blob52dbb4a1f9723c773edaf5b4964b7afd53e101d8
1 <?php
3 class HTMLPurifier_HTMLModule_TargetNoreferrerTest extends HTMLPurifier_HTMLModuleHarness
6 public function setUp()
8 parent::setUp();
9 $this->config->set('HTML.TargetNoreferrer', true);
10 $this->config->set('Attr.AllowedFrameTargets', '_blank');
13 public function testNoreferrer()
15 $this->assertResult(
16 '<a href="http://google.com" target="_blank">x</a>',
17 '<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
21 public function testNoreferrerNoDupe()
23 $this->config->set('Attr.AllowedRel', 'noreferrer');
24 $this->assertResult(
25 '<a href="http://google.com" target="_blank" rel="noreferrer">x</a>',
26 '<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
30 public function testTargetBlankNoreferrer()
32 $this->config->set('HTML.TargetBlank', true);
33 $this->assertResult(
34 '<a href="http://google.com">x</a>',
35 '<a href="http://google.com" target="_blank" rel="noreferrer">x</a>'
42 // vim: et sw=4 sts=4