Skip to content

Commit

Permalink
#14: add tests for the new methods controlling the ListView's items w…
Browse files Browse the repository at this point in the history
…rapper element.
  • Loading branch information
glpzzz committed Sep 7, 2024
1 parent 5d1ce4a commit 57d4a97
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/ListView/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,52 @@ public function testKeysetPaginationConfig(): void
->render(),
);
}

public function testChangeItemsWrapperTag(): void
{
Assert::equalsWithoutLE(
<<<HTML
<div>
<ol>
<li>
<div>Id: 1</div><div>Name: John</div><div>Age: 20</div>
</li>
<li>
<div>Id: 2</div><div>Name: Mary</div><div>Age: 21</div>
</li>
</ol>
<div>Page <b>1</b> of <b>1</b></div>
</div>
HTML,
ListView::widget()
->itemsWrapperTag('ol')
->itemView(dirname(__DIR__) . '/Support/view/_listview.php')
->dataReader($this->createOffsetPaginator($this->data, 10))
->render(),
);
}

public function testChangeItemsWrapperTagAttributes(): void
{
Assert::equalsWithoutLE(
<<<HTML
<div>
<ul class="the-item-wrapper-class">
<li>
<div>Id: 1</div><div>Name: John</div><div>Age: 20</div>
</li>
<li>
<div>Id: 2</div><div>Name: Mary</div><div>Age: 21</div>
</li>
</ul>
<div>Page <b>1</b> of <b>1</b></div>
</div>
HTML,
ListView::widget()
->itemsWrapperAttributes(['class' => 'the-item-wrapper-class'])
->itemView(dirname(__DIR__) . '/Support/view/_listview.php')
->dataReader($this->createOffsetPaginator($this->data, 10))
->render(),
);
}
}

0 comments on commit 57d4a97

Please sign in to comment.