1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Tests for hidding elements

This commit is contained in:
Benjamin Beganović 2020-07-14 14:02:02 +02:00
parent 5307569bba
commit ceecddb8a2

View File

@ -153,4 +153,43 @@ class PdfMakerTest extends TestCase
$this->assertStringContainsString($compiled, $maker->getCompiledHTML());
}
public function testConditionalRenderingOfElements()
{
$maker1 = new PdfMaker([
'template' => [
'header' => [
'id' => 'header',
'properties' => [],
],
],
]);
$maker1
->design(Business::class)
->build();
$output1 = $maker1->getCompiledHTML();
$this->assertStringContainsString('<div id="header">This is $title</div>', $output1);
$maker2 = new PdfMaker([
'template' => [
'header' => [
'id' => 'header',
'properties' => ['hidden' => "true"],
],
],
]);
$maker2
->design(Business::class)
->build();
$output2 = $maker2->getCompiledHTML();
$this->assertStringContainsString('<div id="header" hidden="true">This is $title</div>', $output2);
$this->assertNotSame($output1, $output2);
}
}