Skip to content

Commit a9a023d

Browse files
authored
Add Wrapper Manual Tests
1 parent 69f0b12 commit a9a023d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/Unit/Views/Columns/ArrayColumnTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,30 @@ public function test_can_get_empty_value(): void
8080
$this->assertSame('Unknown', self::$columnInstance->getEmptyValue());
8181

8282
}
83+
84+
public function test_can_use_wrapper(): void
85+
{
86+
self::$columnInstance
87+
->data(fn ($value, $row) => ($row->pets))
88+
->outputFormat(fn ($index, $value) => '<a href="'.$value->id.'">'.$value->name.'</a>')
89+
->wrapperStart('<div class="start-of-wrapper">')
90+
->wrapperEnd("</div>");
91+
92+
$contents = self::$columnInstance->getContents(Veterinary::find(1));
93+
$this->assertSame('<div class="start-of-wrapper"><a href="1">Cartman</a><a href="2">Tux</a></div>', $contents->toHtml());
94+
}
95+
96+
public function test_can_use_wrapper_ul(): void
97+
{
98+
self::$columnInstance
99+
->data(fn ($value, $row) => ($row->pets))
100+
->outputFormat(fn ($index, $value) => '<li><a href="'.$value->id.'">'.$value->name.'</a></li>')
101+
->wrapperStart('<ul class="start-of-wrapper">')
102+
->wrapperEnd("</ul>");
103+
104+
$contents = self::$columnInstance->getContents(Veterinary::find(1));
105+
$this->assertSame('<ul class="start-of-wrapper"><li><a href="1">Cartman</a></li><li><a href="2">Tux</a></li></ul>', $contents->toHtml());
106+
}
83107

84108
public function test_can_use_flexcol(): void
85109
{

0 commit comments

Comments
 (0)