Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add A::nofollow() method, Html::nofollow() method, test cases #91

Merged
merged 9 commits into from
Oct 20, 2021
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## 2.1.1 under development

- no changes in this release.
- New #89: Add method `nofollow()` to the `A` tag (soodssr)

## 2.1.0 September 23, 2021

Expand Down
5 changes: 5 additions & 0 deletions src/Tag/A.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public function mailto(?string $mail): self
return $this->href($mail === null ? null : 'mailto:' . $mail);
}

public function nofollow(): self
{
return $this->rel('nofollow');
}

/**
* @link https://www.w3.org/TR/html52/links.html#element-attrdef-a-rel
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/common/Tag/ATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public function testRel(string $expected, ?string $rel): void
$this->assertSame($expected, (string)A::tag()->rel($rel));
}

public function testNofollow(): void
{
$this->assertSame('<a rel="nofollow"></a>', (string)A::tag()->nofollow());
}

public function dataTarget(): array
{
return [
Expand Down