TargetBlankTest.php 838 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class HTMLPurifier_HTMLModule_TargetBlankTest extends HTMLPurifier_HTMLModuleHarness
  3. {
  4. public function setUp()
  5. {
  6. parent::setUp();
  7. $this->config->set('HTML.TargetBlank', true);
  8. }
  9. public function testTargetBlank()
  10. {
  11. $this->assertResult(
  12. '<a href="http://google.com">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
  13. '<a href="http://google.com" target="_blank" rel="noreferrer noopener">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
  14. );
  15. }
  16. public function testTargetBlankNoDupe() {
  17. $this->assertResult(
  18. '<a href="http://google.com" target="_blank">a</a>',
  19. '<a href="http://google.com" target="_blank" rel="noreferrer noopener">a</a>'
  20. );
  21. }
  22. }
  23. // vim: et sw=4 sts=4