From 94f5456d486c679f9145154b51fd16a6715ae09e Mon Sep 17 00:00:00 2001 From: Cristian Necula Date: Sat, 30 Mar 2019 01:42:22 +0200 Subject: [PATCH 1/4] (patch) when `items` is [], the templates render [[index]] as -1 --- cosmoz-data-nav.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmoz-data-nav.js b/cosmoz-data-nav.js index 7fa3ec1..3e9b10c 100644 --- a/cosmoz-data-nav.js +++ b/cosmoz-data-nav.js @@ -595,7 +595,7 @@ return { prevDisabled: index < 1, nextDisabled: index + 1 >= this.items.length, - [this.indexAs]: Math.min(Math.max(index, 0), this.items.length - 1) + [this.indexAs]: Math.max(Math.min(index, this.items.length - 1), 0) }; } From 7aae8e21efe936262894956f1f775852b221533f Mon Sep 17 00:00:00 2001 From: Cristian Necula Date: Sat, 30 Mar 2019 01:50:59 +0200 Subject: [PATCH 2/4] (tests) _resetElement does not run correctly during the test Wait a bit, so that the data-nav has finished initializing. Re #77 --- test/spec.html | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/test/spec.html b/test/spec.html index 8de7fc6..52f0e87 100644 --- a/test/spec.html +++ b/test/spec.html @@ -37,11 +37,13 @@ @@ -49,6 +51,8 @@