diff --git a/composer.lock b/composer.lock index 249991a..723285a 100644 --- a/composer.lock +++ b/composer.lock @@ -50,16 +50,16 @@ }, { "name": "phpgt/dom", - "version": "v2.1.5", + "version": "v2.1.6", "source": { "type": "git", "url": "https://github.com/PhpGt/Dom.git", - "reference": "42846f6f5d2c3e656245fb8afe7bfa92ebfd7f4d" + "reference": "fceb86cdb32e846178f75b7f9806d2b77635a879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Dom/zipball/42846f6f5d2c3e656245fb8afe7bfa92ebfd7f4d", - "reference": "42846f6f5d2c3e656245fb8afe7bfa92ebfd7f4d", + "url": "https://api.github.com/repos/PhpGt/Dom/zipball/fceb86cdb32e846178f75b7f9806d2b77635a879", + "reference": "fceb86cdb32e846178f75b7f9806d2b77635a879", "shasum": "" }, "require": { @@ -127,7 +127,7 @@ } ], "description": "The modern DOM API for PHP 7 projects.", - "time": "2019-11-25T17:01:04+00:00" + "time": "2020-01-15T08:28:10+00:00" }, { "name": "psr/http-message", @@ -239,16 +239,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", "shasum": "" }, "require": { @@ -283,7 +283,7 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "time": "2019-12-15T19:12:40+00:00" }, { "name": "phar-io/manifest", @@ -441,16 +441,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", + "version": "4.3.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", "shasum": "" }, "require": { @@ -462,6 +462,7 @@ "require-dev": { "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", "phpunit/phpunit": "^6.4" }, "type": "library", @@ -488,7 +489,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" + "time": "2019-12-28T18:55:12+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -539,33 +540,33 @@ }, { "name": "phpspec/prophecy", - "version": "1.9.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -598,7 +599,7 @@ "spy", "stub" ], - "time": "2019-10-03T11:07:50+00:00" + "time": "2019-12-22T21:05:45+00:00" }, { "name": "phpunit/php-code-coverage", @@ -854,16 +855,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.4.3", + "version": "8.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e" + "reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", - "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/018b6ac3c8ab20916db85fa91bf6465acb64d1e0", + "reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0", "shasum": "" }, "require": { @@ -907,7 +908,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.4-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -933,7 +934,7 @@ "testing", "xunit" ], - "time": "2019-11-06T09:42:23+00:00" + "time": "2020-01-08T08:49:49+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1552,7 +1553,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", diff --git a/src/Bindable.php b/src/Bindable.php index 6e8e95d..8454970 100644 --- a/src/Bindable.php +++ b/src/Bindable.php @@ -95,6 +95,10 @@ public function bindList( string $templateName = null ):int { if(empty($kvpList)) { + if($this->children->length === 0) { + $this->innerHTML = ""; + } + return 0; } diff --git a/test/unit/BindableTest.php b/test/unit/BindableTest.php index 9633b71..7878d35 100644 --- a/test/unit/BindableTest.php +++ b/test/unit/BindableTest.php @@ -621,7 +621,7 @@ public function testTemplateNameIsAddedWhenNamed() { foreach(["one", "two", "three"] as $num) { $t = $document->getTemplate("list-item"); - $t->innerText = $num; + $t->innerHTML = $num; $inserted = $t->insertTemplate(); self::assertStringContainsString("t-list-item", $inserted->getAttribute("class")); @@ -651,4 +651,12 @@ public function testBindKeyValueBool() { self::assertFalse($listItems[0]->classList->contains("completed")); self::assertTrue($listItems[1]->classList->contains("completed")); } + + public function testBindListEmptySetsInnerHtmlToEmpty() { + $document = new HTMLDocument(Helper::HTML_TODO_LIST); + $document->extractTemplates(); + $ul = $document->getElementById("todo-list"); + $ul->bindList([]); + self::assertEquals("", $ul->innerHTML); + } } \ No newline at end of file