diff --git a/test/phpunit/DocumentBinderTest.php b/test/phpunit/DocumentBinderTest.php index 6520369..8c876d1 100644 --- a/test/phpunit/DocumentBinderTest.php +++ b/test/phpunit/DocumentBinderTest.php @@ -379,6 +379,14 @@ public function testBindList():void { } } + public function testBindList_emptyLeavesNoWhiteSpace():void { + $document = DocumentTestFactory::createHTML(DocumentTestFactory::HTML_LIST_TEMPLATE); + $sut = new DocumentBinder($document); + $listData = []; + $sut->bindList($listData); + self::assertEquals("", $document->querySelector("ul")->innerHTML); + } + public function testBindData_objectWithAttribute():void { $document = DocumentTestFactory::createHTML(DocumentTestFactory::HTML_USER_PROFILE); $sut = new DocumentBinder($document); diff --git a/test/phpunit/ListBinderTest.php b/test/phpunit/ListBinderTest.php index b883309..0e7d105 100644 --- a/test/phpunit/ListBinderTest.php +++ b/test/phpunit/ListBinderTest.php @@ -28,6 +28,14 @@ public function testBindList_emptyList():void { self::assertSame(0, $boundCount); } + public function testBindList_empty_shouldHaveNoWhitespace():void { + $document = DocumentTestFactory::createHTML(DocumentTestFactory::HTML_LIST_TEMPLATE); + $templateCollection = new TemplateCollection($document); + $sut = new ListBinder($templateCollection); + $sut->bindListData([], $document); + self::assertSame("", $document->querySelector("ul")->innerHTML); + } + public function testBindList_emptyList_iterator():void { $document = DocumentTestFactory::createHTML(DocumentTestFactory::HTML_LIST_TEMPLATE);