Skip to content

Commit

Permalink
Add test for boolean attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Pallarés committed Aug 16, 2016
1 parent 1add9b4 commit dc15cf8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/HtmlBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testTag()
$this->htmlBuilder->image('http://example.com/image1'),
$this->htmlBuilder->image('http://example.com/image2'),
];

$result4 = $this->htmlBuilder->tag('div', $content, ['class' => 'row']);

$this->assertEquals('<p>' . PHP_EOL . 'Lorem ipsum dolor sit amet.' . PHP_EOL . '</p>' . PHP_EOL, $result1);
Expand Down Expand Up @@ -115,4 +115,15 @@ public function testMailto()
$this->assertEquals('<a href="mailto:person@example.com" class="example-link">&lt;span&gt;First Name Last&lt;/span&gt;</a>', $result1);
$this->assertEquals('<a href="mailto:person@example.com" class="example-link"><span>First Name Last</span></a>', $result2);
}

public function testBooleanAttributes()
{
$result1 = $this->htmlBuilder->attributes(['my-property' => true]);

$result2 = $this->htmlBuilder->attributes(['my-property' => false]);

$this->assertEquals('my-property', trim($result1));

$this->assertEquals('', trim($result2));
}
}

0 comments on commit dc15cf8

Please sign in to comment.