diff --git a/src/ListView.php b/src/ListView.php index a62871c69..2922c9ff8 100644 --- a/src/ListView.php +++ b/src/ListView.php @@ -136,6 +136,13 @@ public function itemView(string|Closure $value): self return $new; } + public function itemViewTag(?string $tag): self + { + $new = clone $this; + $new->itemViewTag= $tag; + return $new; + } + /** * return new instance with the HTML attributes for the container of item view. * diff --git a/tests/ListView/BaseTest.php b/tests/ListView/BaseTest.php index 7c869df83..8e70c279a 100644 --- a/tests/ListView/BaseTest.php +++ b/tests/ListView/BaseTest.php @@ -292,6 +292,31 @@ public function testChangeItemsWrapperTag(): void ); } + public function testChangeItemsAndItemWrapperTag(): void + { + Assert::equalsWithoutLE( + << +
+
+
Id: 1
Name: John
Age: 20
+
+
+
Id: 2
Name: Mary
Age: 21
+
+
+
Page 1 of 1
+ + HTML, + ListView::widget() + ->itemsWrapperTag('div') + ->itemViewTag('div') + ->itemView(dirname(__DIR__) . '/Support/view/_listview.php') + ->dataReader($this->createOffsetPaginator($this->data, 10)) + ->render(), + ); + } + public function testChangeItemsWrapperTagAttributes(): void { Assert::equalsWithoutLE( @@ -315,4 +340,6 @@ public function testChangeItemsWrapperTagAttributes(): void ->render(), ); } + + }